public class NodeReader
extends java.lang.Object
NodeReader object is used to read elements from
the specified XML event reader. This reads input node objects
that represent elements within the source XML document. This will
allow details to be read using input node objects, as long as
the end elements for those input nodes have not been ended.
For example, if an input node represented the root element of a document then that input node could read all elements within the document. However, if the input node represented a child element then it would only be able to read its children.
| Constructor and Description |
|---|
NodeReader(EventReader reader)
Constructor for the
NodeReader object. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty(InputNode from)
This is used to determine if this input node is empty.
|
boolean |
isRoot(InputNode node)
This method is used to determine if this node is the root
node for the XML document.
|
InputNode |
readElement(InputNode from)
Returns the next input node from the XML document, if it is a
child element of the specified input node.
|
InputNode |
readElement(InputNode from,
java.lang.String name)
Returns the next input node from the XML document, if it is a
child element of the specified input node.
|
InputNode |
readRoot()
Returns the root input node for the document.
|
java.lang.String |
readValue(InputNode from)
Read the contents of the characters between the specified XML
element tags, if the read is currently at that element.
|
void |
skipElement(InputNode from)
This method is used to skip an element within the XML document.
|
public NodeReader(EventReader reader)
NodeReader object. This is used
to read XML events a input node objects from the event reader.reader - this is the event reader for the XML documentpublic boolean isRoot(InputNode node)
public InputNode readRoot() throws java.lang.Exception
java.lang.Exceptionpublic InputNode readElement(InputNode from) throws java.lang.Exception
from - this is the input node to read withjava.lang.Exceptionpublic InputNode readElement(InputNode from, java.lang.String name) throws java.lang.Exception
readElement(InputNode) object
except that this will not read the element if it does not have
the name specified. This essentially acts as a peak function.from - this is the input node to read withname - this is the name expected from the next elementjava.lang.Exceptionpublic java.lang.String readValue(InputNode from) throws java.lang.Exception
from - this is the input node to read the value fromjava.lang.Exceptionpublic boolean isEmpty(InputNode from) throws java.lang.Exception
from - this is the input node to read the value fromjava.lang.Exception - thrown if there was a parse errorpublic void skipElement(InputNode from) throws java.lang.Exception
from - this is the element to skip from the XML documentjava.lang.Exception