public abstract class StaxParser extends Object
© Copyright 2010 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected javax.xml.stream.XMLStreamReader |
reader |
| Modifier | Constructor and Description |
|---|---|
protected |
StaxParser(File file)
Create a new parser that parses the XML file specified.
|
protected |
StaxParser(InputStream stream)
Create a new parser that parses the XML data from the input stream specified.
|
protected |
StaxParser(Reader stream)
Create a new parser that parses the XML data from the reader specified.
|
protected |
StaxParser(String contents)
Create a new parser that parses the string contents specified.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
attributeValue(String name)
A convenience wrapper around
XMLStreamReader.getAttributeValue(String, String). |
protected String |
elementText()
A convenience wrapper around
XMLStreamReader.getElementText(). |
protected String |
localName()
A convenience wrapper around
XMLStreamReader.getLocalName(). |
protected void |
nextElement()
Skip to the next element in the XML being parsed.
|
protected void |
skip(String name)
Skip all elements until the first element with the specified name is
found.
|
protected final javax.xml.stream.XMLStreamReader reader
protected StaxParser(String contents) throws javax.xml.stream.XMLStreamException
contents - The XML string to parse.javax.xml.stream.XMLStreamException - If errors are encountered while creating the
reader.StaxParser(java.io.Reader)protected StaxParser(File file) throws javax.xml.stream.XMLStreamException, FileNotFoundException
file - The XML file to parse.javax.xml.stream.XMLStreamException - If errors are encountered while creating the
reader.FileNotFoundException - If the file does not exist.StaxParser(java.io.InputStream)protected StaxParser(InputStream stream) throws javax.xml.stream.XMLStreamException
stream - The input stream to parse.javax.xml.stream.XMLStreamException - If errors are encountered while creating the
reader.protected StaxParser(Reader stream) throws javax.xml.stream.XMLStreamException
stream - The reader to parse.javax.xml.stream.XMLStreamException - If errors are encountered while creating the
reader.protected void nextElement()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If errors are encountered.protected void skip(String name) throws javax.xml.stream.XMLStreamException
name - The name of the element to which the stream is to be skipped.javax.xml.stream.XMLStreamException - If errors are encountered.protected String attributeValue(String name) throws javax.xml.stream.XMLStreamException
XMLStreamReader.getAttributeValue(String, String).
Invokes the method of reader with a value of null for
the namespace.name - The name of the attribute whose value is to be retrieved.javax.xml.stream.XMLStreamException - If errors are encountered.protected String localName() throws javax.xml.stream.XMLStreamException
XMLStreamReader.getLocalName().javax.xml.stream.XMLStreamException - If errors are encountered.protected String elementText() throws javax.xml.stream.XMLStreamException
XMLStreamReader.getElementText().javax.xml.stream.XMLStreamException - If errors are encountered.