public final class SerializeSupport extends Object
Modifier and Type | Field and Description |
---|---|
private static Map<String,Object> |
prettyPrintParams
DOM configuration parameters used by LSSerializer in pretty print format output.
|
Modifier | Constructor and Description |
---|---|
private |
SerializeSupport()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static DOMImplementationLS |
getDOMImplementationLS(Node node)
Gets the DOM, level 3, Load/Store implementation associated with the given node.
|
static LSSerializer |
getLSSerializer(DOMImplementationLS domImplLS,
Map<String,Object> serializerParams)
Obtain a the DOM, level 3, Load/Save serializer
LSSerializer instance from the given
DOMImplementationLS instance. |
static String |
nodeToString(Node node)
Converts a Node into a String using the DOM, level 3, Load/Save serializer.
|
static String |
nodeToString(Node node,
Map<String,Object> serializerParams)
Converts a Node into a String using the DOM, level 3, Load/Save serializer.
|
static String |
prettyPrintXML(Node node)
Converts a Node into a String, using the DOM, level 3, Load/Save serializer.
|
static void |
writeNode(Node node,
OutputStream output)
Writes a Node out to a Writer using the DOM, level 3, Load/Save serializer.
|
static void |
writeNode(Node node,
OutputStream output,
Map<String,Object> serializerParams)
Writes a Node out to a Writer using the DOM, level 3, Load/Save serializer.
|
@Nonnull public static String nodeToString(@Nonnull Node node)
node
- the node to be written to a string@Nonnull public static String nodeToString(@Nonnull Node node, @Nullable Map<String,Object> serializerParams)
node
- the node to be written to a stringserializerParams
- parameters to pass to the DOMConfiguration
of the serializer instance, obtained
via LSSerializer.getDomConfig()
. May be null.@Nonnull public static String prettyPrintXML(@Nonnull Node node)
node
- xml node to printpublic static void writeNode(@Nonnull Node node, @Nonnull OutputStream output)
node
- the node to write outoutput
- the output stream to write the XML topublic static void writeNode(@Nonnull Node node, @Nonnull OutputStream output, @Nullable Map<String,Object> serializerParams)
node
- the node to write outoutput
- the output stream to write the XML toserializerParams
- parameters to pass to the DOMConfiguration
of the serializer instance, obtained
via LSSerializer.getDomConfig()
. May be null.@Nonnull public static LSSerializer getLSSerializer(@Nonnull DOMImplementationLS domImplLS, @Nullable Map<String,Object> serializerParams)
LSSerializer
instance from the given
DOMImplementationLS
instance.
The serializer instance will be configured with the parameters passed as the serializerParams
argument. It will also be configured with an LSSerializerFilter
that shows all nodes to the filter, and
accepts all nodes shown.
domImplLS
- the DOM Level 3 Load/Save implementation to useserializerParams
- parameters to pass to the DOMConfiguration
of the serializer instance, obtained
via LSSerializer.getDomConfig()
. May be null.@Nonnull public static DOMImplementationLS getDOMImplementationLS(@Nonnull Node node)
node
- the node, never nullCopyright © 1999–2019. All rights reserved.