public interface NodeParser
counterpart of this interface that provides the ability to
write node graphs.,
NodeStreamReader| Modifier and Type | Method and Description |
|---|---|
String |
getAttribute(String key)
Retrieves the value of an attribute of the current node.
|
void |
getContent(Writer writer)
Similar to
getContentAsString(), but writes the contents
to the specified Writer instance. |
BigDecimal |
getContentAsBigDecimal() |
BigInteger |
getContentAsBigInteger()
Similar to
getContentAsString(), but converts content
to a BigInteger instance. |
Boolean |
getContentAsBoolean()
Similar to
getContentAsString(), but converts content
to a boolean value. |
Date |
getContentAsDate()
Similar to
getContentAsString(), but converts content
to a Date instance. |
String |
getContentAsString()
Returns the content of the current node as a string.
|
String |
getName()
Returns the name of the current entity.
|
NodeParser |
getNextNode()
Returns the next node in the graph.
|
String |
getRequiredAttribute(String key)
Retrieves the value of an attribute of the current node.
|
boolean |
isClosed()
Returns
true if this instance represents the end of a node
(closing tag in XML). |
String getAttribute(String key) throws IllegalStateException
null is returned.key - the name of the attributenull if the attribute does not existImportExportException - when the input could not be parsedIllegalStateException - when this method was called after one of
the getContent..., or the getNextNode()
method was calledString getRequiredAttribute(String key) throws IllegalStateException
ImportExportException is thrown.key - the name of the attributenull if the attribute is present, but has no value - think
xsi:nil="true")ImportExportException - when the input could not be parsedIllegalStateException - when this method was called after one of
the getContent..., or the getNextNode()
method was calledString getName()
ImportExportException - when the input could not be parsedboolean isClosed()
true if this instance represents the end of a node
(closing tag in XML).
If this is the case, getNextNode() will return a
reference to the parent node. Also, when the end of a node is reached,
getAttribute(String), getRequiredAttribute(String)
and the various getContent() methods can no longer be invoked. Doing so
will raise a ImportExportException.true if this instance represents the end of a nodeImportExportException - when the input could not be parsedNodeParser getNextNode()
isClosed() will be
false on the returned instance);isClosed()
will be true on the returned instance;isClosed() is
true on the current instance), then null will
be returned.ImportExportException - when the input could not be parsedString getContentAsString() throws IllegalStateException
ImportExportException is thrown. When the
current node is a content node, but contains no data (e.g.
<node xsi:nil="true"/> in XML), null is returned.
When this method returns, the current node will be closed. Calling this
method again will raise an IllegalStateException.
ImportExportException - when the current node is not a content node, or
when the input could not be parsedIllegalStateException - if the current node cannot contain
content (for instance because isClosed() is trueBoolean getContentAsBoolean() throws IllegalStateException
getContentAsString(), but converts content
to a boolean value.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is trueDate getContentAsDate() throws IllegalStateException
getContentAsString(), but converts content
to a Date instance.Date instanceImportExportException - when the current node is not a content node, or
when the input could not be parsed, or when the content does not conform
to the standardized date formatIllegalStateException - if the current node cannot contain
content (for instance because isClosed() is trueBigInteger getContentAsBigInteger() throws IllegalStateException
getContentAsString(), but converts content
to a BigInteger instance.BigInteger instanceImportExportException - when the current node is not a content node, or
when the input could not be parsed, or the content does not contain a
numeric integer valueIllegalStateException - if the current node cannot contain
content (for instance because isClosed() is trueBigDecimal getContentAsBigDecimal() throws IllegalStateException
IllegalStateExceptionvoid getContent(Writer writer) throws IllegalStateException
getContentAsString(), but writes the contents
to the specified Writer instance. Useful for reading large lumps
of content in a memory-efficient way. The writer is not closed.writer - the writer to write the contents toImportExportException - when the current node is not a content node, or
when the input could not be parsedIllegalStateException - if the current node cannot contain
content (for instance because isClosed() is trueCopyright © 2018 Atlassian. All rights reserved.