public abstract class StaxParser extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
StaxParser.EndDocumentException |
Modifier and Type | Field and Description |
---|---|
protected XMLStreamReader |
parser |
Constructor and Description |
---|
StaxParser(File f) |
StaxParser(InputStream is) |
StaxParser(String resource,
ClassLoader cl) |
Modifier and Type | Method and Description |
---|---|
protected void |
close() |
protected int |
next()
The same as calling XmlStreamReader.next() except that we throw a special
Exception if the end of the document was reached
|
protected void |
nextStart()
Skip to the next START_ELEMENT
|
protected Map<String,String> |
parseAttributes()
The cursor must be pointing at a START_ELEMENT.
|
protected abstract void |
read() |
protected void |
skipPast(String name)
Skip to the first START_ELEMENT after the given START_ELEMENT name
This is useful for skipping past the root element
|
protected void |
skipTo(String name)
The cursor will be pointing at the START_ELEMENT of name when it returns.
|
protected XMLStreamReader parser
public StaxParser(File f) throws XMLStreamException
XMLStreamException
public StaxParser(String resource, ClassLoader cl) throws XMLStreamException
XMLStreamException
public StaxParser(InputStream is) throws XMLStreamException
XMLStreamException
protected abstract void read() throws XMLStreamException, StaxParser.EndDocumentException
protected int next() throws XMLStreamException, StaxParser.EndDocumentException
XMLStreamException
xml.StaxParser.EndDocumentException
- if the end of the document is hereStaxParser.EndDocumentException
protected void skipTo(String name) throws XMLStreamException, StaxParser.EndDocumentException
name
- the Element to skip toXMLStreamException
StaxParser.EndDocumentException
protected Map<String,String> parseAttributes()
IllegalStateException
- if the cursor is not pointing at a START_ELEMENTprotected void skipPast(String name) throws XMLStreamException, StaxParser.EndDocumentException
name
- The START_ELEMENT to skip pastXMLStreamException
- if any errorsxml.StaxParser.EndDocumentException
- if end of document reached firstStaxParser.EndDocumentException
protected void nextStart() throws XMLStreamException, StaxParser.EndDocumentException
XMLStreamException
xml.StaxParser.EndDocumentException
StaxParser.EndDocumentException
protected void close()
Copyright © 2020. All rights reserved.