| java.lang.Object | ||
| ↳ | org.xml.sax.helpers.DefaultHandler | |
| ↳ | com.google.gdata.wireformats.XmlParser | |
XML parser, branched from XmlParser.
The plan is to integrate it tighter with the WireFormatParser
interface, remove unnecessary interfaces and parameters (in our new
data model, there is only one XmlParser.ElementHandler),
and move it away from the util package.
Existing data classes continue to use the old XML parser until they've been migrated to the new data model, at which point they will start to use the new XML parser.
This is a thin layer on top of a SAX parser. The key concept necessary to understand this parser is Element Handler. Element handlers are type-specific parsers. Each handler instance contains an instance of the Java type corresponding to the XML type it parses. At any given time, one handler is active, and zero or more handlers are kept on the stack. This corresponds directly to the set of currently opened XML tags.
To use this parser, one must define an XmlParser.ElementHandler type (usually one per XML schema type),
specify the root element handler, and pass a reader to the
parse(Element) method.
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| curHandler | Top of the element handler stack. | ||||||||||
| elementNamespaces | Namespace declarations for the current element. | ||||||||||
| eventSource | XML event source, usually a SAX parser. | ||||||||||
| locator | Document locator used to get line and column numbers for SAX events. | ||||||||||
| logger | |||||||||||
| namespaceMap | Set of all namespace declarations valid at the current location. | ||||||||||
| props | Input properties for parsing | ||||||||||
| rootElementName | Root element name. | ||||||||||
| rootHandler | Root element handler. | ||||||||||
| rootNamespace | Root element namespace URI. | ||||||||||
| unrecognizedElements | Number of unrecognized elements on the stack. | ||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Construct XML parser for given reader.
| |||||||||||
Construct XML parser for a given event source.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
SAX callback.
| |||||||||||
SAX callback.
| |||||||||||
SAX callback.
| |||||||||||
SAX callback.
| |||||||||||
Parse content from a source provided to the parser at
construction time.
| |||||||||||
SAX callback.
| |||||||||||
SAX callback.
| |||||||||||
SAX callback.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Create the xml handler for the root element.
| |||||||||||
Throws a parse exception with line/column information.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.xml.sax.helpers.DefaultHandler
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.google.gdata.wireformats.WireFormatParser
| |||||||||||
From interface
org.xml.sax.ContentHandler
| |||||||||||
From interface
org.xml.sax.DTDHandler
| |||||||||||
From interface
org.xml.sax.EntityResolver
| |||||||||||
From interface
org.xml.sax.ErrorHandler
| |||||||||||
Top of the element handler stack.
Namespace declarations for the current element.
Valid during startElement(String, String, String, Attributes).
Document locator used to get line and column numbers for SAX events.
Set of all namespace declarations valid at the current location. Includes namespace declarations from all ancestor elements.
Root element name.
Root element handler.
Root element namespace URI.
Number of unrecognized elements on the stack.
Construct XML parser for given reader.
| props | Stream properties for parsing |
|---|---|
| r | Reader where input is retrieved from |
| cs | Character set used to encode input |
Construct XML parser for a given event source.
| props | Stream properties for parsing |
|---|---|
| eventSource | Event source |
SAX callback.
| text | |
|---|---|
| start | |
| len |
| SAXException |
|---|
SAX callback.
| namespace | |
|---|---|
| localName | |
| qName |
| SAXException |
|---|
SAX callback.
| alias |
|---|
SAX callback.
| text | |
|---|---|
| start | |
| len |
| SAXException |
|---|
Parse content from a source provided to the parser at construction time.
| element | Root of parsed element tree |
|---|
| ContentValidationException | |
|---|---|
| IOException | |
| ParseException |
SAX callback.
| newLocator |
|---|
SAX callback.
| namespace | |
|---|---|
| localName | |
| qName | |
| attrs |
| SAXException |
|---|
SAX callback.
| alias | |
|---|---|
| uri |
Create the xml handler for the root element. Subclasses can supply their own parse handlers.
| vc | |
|---|---|
| element | |
| metadata |