| java.lang.Object | |
| ↳ | com.google.gdata.util.XmlParser.ElementHandler |
Base class for custom element handlers.
To implement a new element handler, one must create a new class
extending this class, override getChildHandler(String, String, String, Attributes, List if nested
elements need to be parsed, override processAttribute(String, String, String) if
attributes need to be parsed, and override processEndElement() to receive the text() value and post-process
the element.
If the handler wishes to store unrecognized XML contents in an XmlBlob value, it must call initializeXmlBlob(XmlBlob, boolean, boolean) either in the
constructor, in parent's getChildHandler(String, String, String, Attributes, List, or in processAttribute(String, String, String). The resulting XmlBlob value is available
following the invocation of processEndElement()
through the object passed to initializeXmlBlob(XmlBlob, boolean, boolean).
This class implements overridable methods to support unrecognized XML parsing if desired.
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| blobNamespaces | Namespaces used by this blob. | ||||||||||
| buffer | Temporary buffer for building up the text() value. | ||||||||||
| fullTextIndex | Flag indicating whether unrecognized XML should be processed for full-text indexing. | ||||||||||
| fullTextIndexWriter | String writer underlying the full-text index string. | ||||||||||
| innerXml | This element's inner XML writer. | ||||||||||
| innerXmlStringWriter | String writer underlying innerXml. | ||||||||||
| mixedContent | Flag indicating whether mixed content unrecognized XML is allowed. | ||||||||||
| okToInitializeXmlBlob | Flag indicating whether it's still OK to call initializeXmlBlob(XmlBlob, boolean, boolean). |
||||||||||
| parent | Keeps track of the element stack. | ||||||||||
| qName | This element's QName. | ||||||||||
| value | This element's text() value. | ||||||||||
| xmlBase | The current state of xml:base. |
||||||||||
| xmlBlob | If the handler is parsing unrecognized XML, this object stores the output. | ||||||||||
| xmlLang | The current state of xml:lang. |
||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Utility routine that combines the current state of
xml:base
with the specified URI to obtain an absolute URI. | |||||||||||
Utility method to return the value of an xsd:boolean attribute.
| |||||||||||
Determines a handler for a child element.
| |||||||||||
Determines a handler for a child element.
| |||||||||||
If a derived class wishes to retrieve all unrecognized XML in a blob,
it calls this method.
| |||||||||||
Called to process an attribute.
| |||||||||||
Called to process an attribute.
| |||||||||||
Called to process this element when the closing tag is encountered.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Utility method to parse provided xsd:boolean value.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Namespaces used by this blob.
Temporary buffer for building up the text() value.
Flag indicating whether unrecognized XML should be processed for
full-text indexing. If set, the resulting string ready for indexing is
stored in fullText. Non-contiguous strings within this
index are separated by '\n'.
String writer underlying the full-text index string.
String writer underlying innerXml.
Flag indicating whether mixed content unrecognized XML is allowed.
Flag indicating whether it's still OK to call initializeXmlBlob(XmlBlob, boolean, boolean).
This element's QName. Used for error reporting.
This element's text() value.
The current state of xml:base.
See http://www.cafeconleche.org/books/xmljava/chapters/ch03s03.html for
more information.
The current state of xml:lang.
See http://www.w3.org/TR/REC-xml/#sec-lang-tag for more information.
Utility routine that combines the current state of xml:base
with the specified URI to obtain an absolute URI.
See http://www.cafeconleche.org/books/xmljava/chapters/ch03s03.html for more information.
| uriValue | URI to be interpreted in the context of xml:base. |
|---|
| ParseException | Invalid URI. |
|---|
Utility method to return the value of an xsd:boolean attribute.
| attrs | Elements attributes to test against. |
|---|---|
| attrName | Attribute name. |
null otherwise.| ParseException | if attribute value is not valid xsd:boolean. |
|---|
Determines a handler for a child element.
The default implementation doesn't recognize anything. The result is a
schema error unless the parent handler accepts unrecognized XML.
XmlParser.
localname/namespace.
| namespace | Child element namespace URI. |
|---|---|
| localName | Child element name. |
| attrs | Child element attributes. These attributes will be
communicated to the child element handler through its
processAttribute(String, String, String) method. They are passed here because
sometimes the value of some attribute determines the element's
content type, so different element handlers may be needed. |
null if the child is
unrecognized.| ParseException | Invalid child element. |
|---|---|
| IOException | Internal I/O exception (e.g., thrown by XML blob writer). |
Determines a handler for a child element.
The default implementation doesn't recognize anything. The result is a
schema error unless the parent handler accepts unrecognized XML.
XmlParser.
localname/namespace.
| namespace | Child element's namespace URI. |
|---|---|
| qualifiedName | Child element's qualified name. |
| localName | Child element's local name. |
| attrs | Child element's attributes. These attributes will be
communicated to the child element handler through its
processAttribute(String, String, String) method. They are passed here because
sometimes the value of some attribute determines the element's
content type, so different element handlers may be needed. |
| namespaces |
null if the child is
unrecognized.| ParseException | Invalid child element. |
|---|---|
| IOException | Internal I/O exception (e.g., thrown by XML blob writer). |
If a derived class wishes to retrieve all unrecognized XML in a blob,
it calls this method. It must be called in the constructor, in
the parent element handler, or in processAttribute(String, String, String).
| xmlBlob | Supplies the XML blob that stores the resulting XML. |
|---|---|
| mixedContent | Specifies that the handler accepts mixed content XML. |
| fullTextIndex | Flag indicating whether unrecognized XML should be processed
for full-text indexing. If set, the resulting string ready for
indexing is stored in fullText.
|
Called to process an attribute. Designed to be overridden by derived classes.
| namespace | Attribute namespace URI. |
|---|---|
| localName | Attribute name. |
| value | Attribute value. |
| ParseException | Invalid attribute. |
|---|
Called to process an attribute. Designed to be overridden by derived classes.
| namespace | Attribute namespace URI. |
|---|---|
| qualifiedName | Attribute's qualified name. |
| localName | Attribute's local name. |
| attrValue | Attribute value. |
| ParseException | Invalid attribute. |
|---|
Called to process this element when the closing tag is encountered. The default implementation refuses to accept text() content, unless the handler is configured to accept unrecognized XML with mixed content.
| ParseException |
|---|
Utility method to parse provided xsd:boolean value.
| value | Xsd:boolean value to parse |
|---|
null| ParseException | if value is not valid xsd:boolean. |
|---|