fr.paris.lutece.plugins.googleapi.service
Class FeedHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by fr.paris.lutece.plugins.googleapi.service.FeedHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
YouTubeHandler

public class FeedHandler
extends org.xml.sax.helpers.DefaultHandler

Simple SAX event handler, which prints out the titles of all entries in the Atom response feed.


Field Summary
protected  boolean _bInsideEntryContent
           
protected  boolean _bInsideEntryTitle
          True if we are inside of a data entry's title, false otherwise.
protected  Item _item
           
protected  java.util.List<Item> _listItems
           
protected  java.util.Stack<java.lang.String> xmlTags
          Stack containing the opening XML tags of the response.
 
Constructor Summary
FeedHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Callback method for receiving notification of character data inside an XML element.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Receive notification of a closing XML tag: remove the tag from teh stack.
 void setItemList(java.util.List<Item> listItems)
          Receive notification of an opening XML tag: push the tag to xmlTags.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_listItems

protected java.util.List<Item> _listItems

xmlTags

protected java.util.Stack<java.lang.String> xmlTags
Stack containing the opening XML tags of the response.


_bInsideEntryTitle

protected boolean _bInsideEntryTitle
True if we are inside of a data entry's title, false otherwise.


_bInsideEntryContent

protected boolean _bInsideEntryContent

_item

protected Item _item
Constructor Detail

FeedHandler

public FeedHandler()
Method Detail

setItemList

public void setItemList(java.util.List<Item> listItems)
Receive notification of an opening XML tag: push the tag to xmlTags. If the tag is a title tag inside an entry tag, turn insideEntryTitle to true.

Parameters:
listItems -

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qName -
attributes -
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Receive notification of a closing XML tag: remove the tag from teh stack. If we were inside of an entry's title, turn insideEntryTitle to false.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qName -
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Callback method for receiving notification of character data inside an XML element.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch -
start -
length -
Throws:
org.xml.sax.SAXException


Copyright © 2009 Mairie de Paris. All Rights Reserved.