|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.xml.def.DefaultXMLReader
public class DefaultXMLReader
Default XML reader implementation of the XMLReader interface.
Does not add any feature not already documented in the implemented interface.
This reader is not thread safe.
Field Summary |
---|
Fields inherited from interface tuwien.auto.calimero.xml.XMLReader |
---|
CHAR_DATA, END_DOC, END_TAG, NO_INPUT, START_DOC, START_TAG |
Constructor Summary | |
---|---|
DefaultXMLReader()
Creates a new XML reader. |
|
DefaultXMLReader(java.io.Reader r,
boolean close)
Creates a new XML reader with input r . |
Method Summary | |
---|---|
void |
close()
Closes this XML reader. |
void |
complete(Element e)
Reads until end of element e . |
Element |
getCurrent()
Returns the current element read with the last invocation of XMLReader.read() . |
int |
getLineNumber()
Returns the line number for the current position in a XML input source processed by this XML reader. |
int |
getPosition()
Returns the current logical position in a XML document for this XML reader. |
int |
read()
Reads to the next XML element tag, a CDATA section or character data. |
void |
setInput(java.io.Reader input,
boolean close)
Sets the input source for this XML reader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultXMLReader()
public DefaultXMLReader(java.io.Reader r, boolean close)
r
.
The Reader
should already be buffered or wrapped with a buffered reader, if
necessary (e.g. when reading from a file).
r
- a Reader
for inputclose
- true
to close r
if XML reader is closed,
false
otherwiseXMLReader.setInput(Reader, boolean)
Method Detail |
---|
public void close() throws KNXMLException
XMLReader
If this XML reader is already closed, no action is performed. If for an input
source was specified to get closed on invocation of this method, it is closed first
(calling Reader.close()
.
close
in interface XMLReader
KNXMLException
public void complete(Element e) throws KNXMLException
XMLReader
e
.
All gathered relevant information is stored into e
.
complete
in interface XMLReader
e
- the element to be completed
KNXMLException
- if document is not well-formed, e.g. end of input or end-tag
of parent element was reached before end of specified elementpublic final Element getCurrent()
XMLReader
XMLReader.read()
.
getCurrent
in interface XMLReader
null
if no element is availablepublic final int getLineNumber()
XMLReader
On no input source, or before an input source is first read, 0 is returned.
getLineNumber
in interface XMLReader
public final int getPosition()
XMLReader
The position is given with constants like XMLReader.START_DOC
or similar. If no
input was set or the reader is closed, XMLReader.NO_INPUT
is returned.
getPosition
in interface XMLReader
public int read() throws KNXMLException
XMLReader
The logical position returned by this method can also be obtained with
XMLReader.getPosition()
.
Comments and processing instructions can be ignored, i.e. skipped on reading.
read
in interface XMLReader
KNXMLException
- on read error or a not well-formed XML documentpublic void setInput(java.io.Reader input, boolean close)
XMLReader
If this XML reader was already closed, setting a new input has no effect.
setInput
in interface XMLReader
input
- a reader with input, like obtained from
EntityResolver.getInputReader(java.io.InputStream)
close
- true
if the specified input reader should be closed on
XMLReader.close()
, false
to leave it open
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |