public class StringListXMLEventParser extends AbstractXMLEventParser implements Iterable<String>
Modifier and Type | Field and Description |
---|---|
protected QName |
elementName |
protected List<String> |
strings |
CHARACTERS_CONTENT, fields, namespaceURI, parent
Constructor and Description |
---|
StringListXMLEventParser() |
StringListXMLEventParser(String namespaceUri) |
StringListXMLEventParser(String namespaceURI,
QName elementName)
Create a parser.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addString(String string) |
protected void |
doParseEventContent(XMLEventParserContext ctx,
XMLEvent event,
Object... args)
Parse an event's sub-elements.
|
List<String> |
getStrings() |
Iterator<String> |
iterator() |
XMLEventParser |
newInstance()
Creates a new empty parser instance of the same type.
|
Object |
parse(XMLEventParserContext ctx,
XMLEvent listEvent,
Object... args)
Parse the event and initialize the parser's values to those found in the event.
|
allocate, doAddCharacters, doAddEventAttribute, doAddEventContent, doParseEventAttributes, freeResources, getAConstructor, getCharacters, getField, getField, getFields, getNamespaceURI, getParent, getRoot, hasField, hasField, hasFields, mergeFields, overrideFields, parseCharacterContent, removeField, setField, setField, setFields, setNamespaceURI, setParent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public StringListXMLEventParser()
public StringListXMLEventParser(String namespaceUri)
public StringListXMLEventParser(String namespaceURI, QName elementName)
namespaceURI
- the namespace URI to attach to this parser. May be null.elementName
- the name of the sub-elements that contain the strings.protected void addString(String string)
protected void doParseEventContent(XMLEventParserContext ctx, XMLEvent event, Object... args) throws XMLStreamException
AbstractXMLEventParser
doParseEventContent
in class AbstractXMLEventParser
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 XMLEventParser newInstance() throws Exception
XMLEventParser
XMLEventParserContext
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 XMLEventParser
newInstance
in class AbstractXMLEventParser
Exception
- if an error or exception occurs while attempting to create the parser.public Object parse(XMLEventParserContext ctx, XMLEvent listEvent, Object... args) throws XMLStreamException
AbstractXMLEventParser
parse
in interface XMLEventParser
parse
in class AbstractXMLEventParser
ctx
- a current parser context.listEvent
- 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.