|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.util.xml.AbstractXMLEventParser
public abstract class AbstractXMLEventParser
Base class for XML event parsers. Handles parsing control and creation of new parser instances.
A parser holds the information parsed from the event stream. That information can be queried via the parser's accessors. A parser typically does not maintain a reference to the event stream it parsed or the parser context used during parsing. Parsers are created when events of the associated type are encountered in the input stream. Anallocate(XMLEventParserContext, javax.xml.stream.events.XMLEvent) method in the parser typically creates a default
parser prior to consulting the XMLEventParserContext, which returns a new parser whose type is determined by
consulting a table of event types. The default parser is returned if the table contains no entry for the event type.
A parser can be associated with a specific namespace. The namespace is used to qualify the parser's association with
event types.
| Field Summary | |
|---|---|
protected static String |
CHARACTERS_CONTENT
|
protected AVList |
fields
|
protected String |
namespaceURI
|
protected XMLEventParser |
parent
|
| Constructor Summary | |
|---|---|
AbstractXMLEventParser()
Construct a parser with no qualifying namespace. |
|
AbstractXMLEventParser(String namespaceURI)
Constructs a parser and qualifies it for a specified namespace. |
|
| Method Summary | |
|---|---|
XMLEventParser |
allocate(XMLEventParserContext ctx,
XMLEvent event)
Create a parser for a specified event. |
protected void |
doAddCharacters(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
|
protected void |
doAddEventAttribute(Attribute attr,
XMLEventParserContext ctx,
XMLEvent event,
Object... args)
|
protected void |
doAddEventContent(Object o,
XMLEventParserContext ctx,
XMLEvent event,
Object... args)
|
protected void |
doParseEventAttributes(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
Parse an event's attributes. |
protected void |
doParseEventContent(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
Parse an event's sub-elements. |
void |
freeResources()
Release large resources used by the parser, but does not dispose of the parser itself. |
protected Constructor<? extends AbstractXMLEventParser> |
getAConstructor(Class... parameterTypes)
|
String |
getCharacters()
|
Object |
getField(QName keyName)
|
Object |
getField(String keyName)
|
AVList |
getFields()
|
String |
getNamespaceURI()
Returns the qualifying namespace URI specified at construction. |
XMLEventParser |
getParent()
Returns this parser's parent parser. |
XMLEventParser |
getRoot()
|
boolean |
hasField(QName keyName)
|
boolean |
hasField(String keyName)
|
boolean |
hasFields()
|
protected AbstractXMLEventParser |
mergeFields(AbstractXMLEventParser s1,
AbstractXMLEventParser s2)
|
XMLEventParser |
newInstance()
Creates a new empty parser instance of the same type. |
protected AbstractXMLEventParser |
overrideFields(AbstractXMLEventParser s1,
AbstractXMLEventParser s2)
|
Object |
parse(XMLEventParserContext ctx,
XMLEvent inputEvent,
Object... args)
Parse the event and initialize the parser's values to those found in the event. |
protected String |
parseCharacterContent(XMLEventParserContext ctx,
XMLEvent stringEvent,
Object... args)
|
void |
removeField(String keyName)
|
void |
setField(QName keyName,
Object value)
|
void |
setField(String keyName,
Object value)
|
void |
setFields(Map<String,Object> newFields)
|
void |
setParent(XMLEventParser parent)
Specifies the parent parser of this parser. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String CHARACTERS_CONTENT
protected AVList fields
protected final String namespaceURI
protected XMLEventParser parent
| Constructor Detail |
|---|
public AbstractXMLEventParser()
public AbstractXMLEventParser(String namespaceURI)
namespaceURI - the qualifying namespace URI. May be null to indicate no namespace qualification.| Method Detail |
|---|
public XMLEventParser allocate(XMLEventParserContext ctx,
XMLEvent event)
ctx - the current parser context.event - the event for which the parser is created. Only the event type is used; the new parser can operate
on any event of that type.
protected void doAddCharacters(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
protected void doAddEventAttribute(Attribute attr,
XMLEventParserContext ctx,
XMLEvent event,
Object... args)
throws XMLStreamException
XMLStreamException
protected void doAddEventContent(Object o,
XMLEventParserContext ctx,
XMLEvent event,
Object... args)
throws XMLStreamException
XMLStreamException
protected void doParseEventAttributes(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
throws XMLStreamException
ctx - a current parser context.event - the event to parse.args - an optional list of arguments that may by used by subclasses.
XMLStreamException - if an exception occurs during event-stream reading.
protected void doParseEventContent(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
throws XMLStreamException
ctx - a current parser context.event - the event to parse.args - an optional list of arguments that may by used by subclasses.
XMLStreamException - if an exception occurs during event-stream reading.public void freeResources()
XMLEventParser
freeResources in interface XMLEventParserprotected Constructor<? extends AbstractXMLEventParser> getAConstructor(Class... parameterTypes)
public String getCharacters()
public Object getField(QName keyName)
public Object getField(String keyName)
public AVList getFields()
public String getNamespaceURI()
public XMLEventParser getParent()
XMLEventParser
getParent in interface XMLEventParserpublic XMLEventParser getRoot()
public boolean hasField(QName keyName)
public boolean hasField(String keyName)
public boolean hasFields()
protected AbstractXMLEventParser mergeFields(AbstractXMLEventParser s1,
AbstractXMLEventParser s2)
public XMLEventParser newInstance()
throws Exception
XMLEventParserXMLEventParserContext when creating parsers associated with specific event types.
The returned parser has the same namespace as the instance creating it, but has empty fields for all other
values.
newInstance in interface XMLEventParserException - if an error or exception occurs while attempting to create the parser.
protected AbstractXMLEventParser overrideFields(AbstractXMLEventParser s1,
AbstractXMLEventParser s2)
public Object parse(XMLEventParserContext ctx,
XMLEvent inputEvent,
Object... args)
throws XMLStreamException
parse in interface XMLEventParserctx - a current parser context.inputEvent - the event to parse.args - an optional list of arguments that may by used by subclasses.
this, otherwise returns null.
XMLStreamException - if an exception occurs during event-stream reading.
protected String parseCharacterContent(XMLEventParserContext ctx,
XMLEvent stringEvent,
Object... args)
throws XMLStreamException
XMLStreamExceptionpublic void removeField(String keyName)
public void setField(QName keyName,
Object value)
public void setField(String keyName,
Object value)
public void setFields(Map<String,Object> newFields)
public void setParent(XMLEventParser parent)
XMLEventParser
setParent in interface XMLEventParserparent - this parser's parent parser.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||