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 attribute.null if the attribute
does not exist.ImportExportException - when the input could not be parsed.IllegalStateException - when this method was called after one of
the getContent..., or the getNextNode()
method was called.String getRequiredAttribute(String key) throws IllegalStateException
ImportExportException is thrown.key - the name of the attribute.null if the attribute is present, but has no value - think
xsi:nil="true").ImportExportException - when the input could not be parsed.IllegalStateException - when this method was called after one of
the getContent..., or the getNextNode()
method was called.String getName()
ImportExportException - when the input could not be parsed.boolean 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 node.ImportExportException - when the input could not be parsed.NodeParser 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 parsed.String getContentAsString() throws IllegalStateException
ImportExportException is thrown. When the
current node is a content node, but contains no data (e.g.
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 parsed.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is true.Boolean getContentAsBoolean() throws IllegalStateException
getContentAsString(), but converts content
to a boolean value.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is true.Date getContentAsDate() throws IllegalStateException
getContentAsString(), but converts content
to a Date instance.Date instance.ImportExportException - 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 format.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is true.BigInteger getContentAsBigInteger() throws IllegalStateException
getContentAsString(), but converts content
to a BigInteger instance.BigInteger instance.ImportExportException - 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 value.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is true.BigDecimal 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 - ImportExportException - when the current node is not a content node, or
when the input could not be parsed.IllegalStateException - if the current node cannot contain
content (for instance because isClosed() is true.Copyright © 2018 Atlassian. All rights reserved.