Package org.simpleframework.xml.stream
Class NodeBuilder
java.lang.Object
org.simpleframework.xml.stream.NodeBuilder
The
NodeBuilder
object is used to create either an
input node or an output node for a given source or destination.
If an InputNode
is required for reading an XML
document then a reader must be provided to read the content from.
If an OutputNode
is required then a destination is
required. The provided output node can be used to generate well
formed XML to the specified writer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputNode
read
(InputStream source) This is used to create anInputNode
that can be used to read XML from the specified stream.static InputNode
This is used to create anInputNode
that can be used to read XML from the specified reader.private static InputNode
read
(EventReader source) This is used to create anInputNode
that can be used to read XML from the specified reader.static OutputNode
This is used to create anOutputNode
that can be used to write a well formed XML document.static OutputNode
This is used to create anOutputNode
that can be used to write a well formed XML document.
-
Field Details
-
PROVIDER
This is the XML provider implementation that creates readers.
-
-
Constructor Details
-
NodeBuilder
public NodeBuilder()
-
-
Method Details
-
read
This is used to create anInputNode
that can be used to read XML from the specified stream. The stream will be positioned at the root element in the XML document.- Parameters:
source
- this contains the contents of the XML source- Throws:
Exception
- thrown if there is an I/O exception
-
read
This is used to create anInputNode
that can be used to read XML from the specified reader. The reader will be positioned at the root element in the XML document.- Parameters:
source
- this contains the contents of the XML source- Throws:
Exception
- thrown if there is an I/O exception
-
read
This is used to create anInputNode
that can be used to read XML from the specified reader. The reader will be positioned at the root element in the XML document.- Parameters:
source
- this contains the contents of the XML source- Throws:
Exception
- thrown if there is an I/O exception
-
write
This is used to create anOutputNode
that can be used to write a well formed XML document. The writer specified will have XML elements, attributes, and text written to it as output nodes are created and populated.- Parameters:
result
- this contains the result of the generated XML- Throws:
Exception
- this is thrown if there is an I/O error
-
write
This is used to create anOutputNode
that can be used to write a well formed XML document. The writer specified will have XML elements, attributes, and text written to it as output nodes are created and populated.- Parameters:
result
- this contains the result of the generated XMLformat
- this is the format to use for the document- Throws:
Exception
- this is thrown if there is an I/O error
-