public class XMLStreamReader extends XMLStreamEventsSync
XMLStreamReader: read-only, forward, event based.
The method next() allows to move forward to the next event (such as start element, end element, comment, text...).
It uses UnprotectedString to avoid allocating many character arrays.
Charset is automatically detected by reading the beginning of the XML (either with auto-detection or with the specified encoding).XMLStreamEvents.Attribute, XMLStreamEvents.ElementContext, XMLStreamEvents.Event, XMLStreamEvents.Starterevent| Constructor and Description |
|---|
XMLStreamReader(IO.Readable io,
Charset defaultEncoding,
int charactersBuffersSize)
Initialize with the given IO.
|
XMLStreamReader(IO.Readable io,
int charactersBuffersSize)
Constructor, without charset.
|
| Modifier and Type | Method and Description |
|---|---|
Pair<Integer,Integer> |
getPosition()
Return the current line number and character number on the line.
|
void |
next()
Move forward to the next event.
|
void |
start()
Start reading the XML to provide the first event.
|
static AsyncWork<XMLStreamReader,Exception> |
start(IO.Readable.Buffered io,
int charactersBufferSize)
Utility method that initialize a XMLStreamReader, initialize it, and
return an AsyncWork which is unblocked when characters are available to be read.
|
void |
startRootElement()
Shortcut to move forward to the first START_ELEMENT event, skipping the header or comments.
|
closeElement, goInto, nextInnerElement, nextInnerElement, nextStartElement, readInnerElementsText, readInnerText, searchElementgetAttributeByFullName, getAttributeByLocalName, getAttributeValueByFullName, getAttributeValueByLocalName, getAttributeValueWithNamespaceURI, getAttributeValueWithPrefix, getAttributeWithNamespaceURI, getAttributeWithPrefix, getNamespaceURI, isSpaceChar, onStartElement, readNamespaces, removeAttributeByFullName, removeAttributeByLocalName, removeAttributeWithNamespaceURI, removeAttributeWithPrefix, resetpublic XMLStreamReader(IO.Readable io, Charset defaultEncoding, int charactersBuffersSize)
PreBufferedReadable is created.
If the charset is null, it will be automatically detected.public XMLStreamReader(IO.Readable io, int charactersBuffersSize)
public static AsyncWork<XMLStreamReader,Exception> start(IO.Readable.Buffered io, int charactersBufferSize)
public void start()
throws XMLException,
IOException
XMLStreamEventsSyncstart in class XMLStreamEventsSyncXMLExceptionIOExceptionpublic void next()
throws XMLException,
IOException
next in class XMLStreamEventsSyncXMLExceptionIOExceptionpublic Pair<Integer,Integer> getPosition()
XMLStreamEventsSyncgetPosition in class XMLStreamEventsSyncpublic void startRootElement()
throws XMLException,
IOException
XMLExceptionIOExceptionCopyright © 2018. All rights reserved.