public abstract class ElementParser<T> extends Object
Element Parser is the core parsing element for XML files. Implementations can be made for data types, encapsulating all of the parsing rules for that type's XML definition.
An Element parser should have a defined scope of a single tag and its descendants in the document. The ElementParser should receive the parser pointing to that opening tag, and return it on the closing tag
A number of helper methods are provided in the parser which are intended to standardize the techniques used for validation and pull-parsing through the XML Document.
| Modifier and Type | Field and Description |
|---|---|
protected org.kxml2.io.KXmlParser |
parser |
| Modifier and Type | Method and Description |
|---|---|
static org.kxml2.io.KXmlParser |
instantiateParser(InputStream stream)
Prepares a parser that will be used by the element parser, configuring relevant
parameters and setting it to the appropriate point in the document.
|
abstract T |
parse()
Parses the XML document at the current level, returning the datatype
described by the document.
|
public static org.kxml2.io.KXmlParser instantiateParser(InputStream stream) throws IOException
stream - A stream which is reading the XML content
of the document.IOException - If the stream cannot be read for any reason
other than invalid XML Structures.public abstract T parse() throws InvalidStructureException, IOException, org.xmlpull.v1.XmlPullParserException, UnfullfilledRequirementsException
InvalidStructureException - If the XML does not contain properly
structured XMLIOException - If there is a problem retrieving the documentorg.xmlpull.v1.XmlPullParserException - If the document does not contain well-
formed XML.UnfullfilledRequirementsExceptionCopyright © 2023. All rights reserved.