@Immutable public final class XMLWriter extends Object
| Modifier and Type | Field and Description |
|---|---|
static NamespaceContext |
DEFAULT_NAMESPACE_CTX
By default no XML namespace map is present
|
static EXMLVersion |
DEFAULT_XML_VERSION
The default XML version to be used
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getNodeAsBytes(Node aNode)
Convert the passed micro node to an XML byte array using
XMLWriterSettings.DEFAULT_XML_SETTINGS. |
static byte[] |
getNodeAsBytes(Node aNode,
IXMLWriterSettings aSettings)
Convert the passed DOM node to an XML byte array using the provided XML
writer settings.
|
static String |
getNodeAsString(Node aNode)
Convert the passed DOM node to an XML string using
XMLWriterSettings.DEFAULT_XML_SETTINGS. |
static String |
getNodeAsString(Node aNode,
IXMLWriterSettings aSettings)
Convert the passed DOM node to an XML string using the provided XML writer
settings.
|
static com.helger.commons.state.ESuccess |
writeToStream(Node aNode,
OutputStream aOS)
Write a node to an
OutputStream using the default settings. |
static com.helger.commons.state.ESuccess |
writeToStream(Node aNode,
OutputStream aOS,
IXMLWriterSettings aSettings)
Write a node to an
OutputStream using custom settings. |
static com.helger.commons.state.ESuccess |
writeToWriter(Node aNode,
Writer aWriter)
Write a node to a
Writer using the default settings. |
static com.helger.commons.state.ESuccess |
writeToWriter(Node aNode,
Writer aWriter,
IXMLWriterSettings aSettings)
Write a node to a
Writer using the default settings. |
public static final EXMLVersion DEFAULT_XML_VERSION
public static final NamespaceContext DEFAULT_NAMESPACE_CTX
@Nonnull public static com.helger.commons.state.ESuccess writeToStream(@Nonnull Node aNode, @Nonnull @WillClose OutputStream aOS)
OutputStream using the default settings.aNode - The node to be serialized. May be any kind of node (incl.
documents). May not be null.aOS - The OutputStream to write to. May not be null.
The OutputStream is closed anyway directly after the
operation finishes (on success and on error).ESuccess@Nonnull public static com.helger.commons.state.ESuccess writeToStream(@Nonnull Node aNode, @Nonnull @WillClose OutputStream aOS, @Nonnull IXMLWriterSettings aSettings)
OutputStream using custom settings.aNode - The node to be serialized. May be any kind of node (incl.
documents). May not be null.aOS - The OutputStream to write to. May not be null.
The OutputStream is closed anyway directly after the
operation finishes (on success and on error).aSettings - The serialization settings to be used. May not be null.ESuccess@Nonnull public static com.helger.commons.state.ESuccess writeToWriter(@Nonnull Node aNode, @Nonnull @WillClose Writer aWriter)
Writer using the default settings.@Nonnull public static com.helger.commons.state.ESuccess writeToWriter(@Nonnull Node aNode, @Nonnull @WillClose Writer aWriter, @Nonnull IXMLWriterSettings aSettings)
Writer using the default settings.aNode - The node to be serialized. May be any kind of node (incl.
documents). May not be null.aWriter - The Writer to write to. May not be null. The
Writer is closed anyway directly after the operation
finishes (on success and on error).aSettings - The serialization settings to be used. May not be null.ESuccess@Nullable public static String getNodeAsString(@Nonnull Node aNode, @Nonnull IXMLWriterSettings aSettings)
aNode - The node to be converted to a string. May not be null .aSettings - The XML writer settings to be used. May not be null.@Nullable public static String getNodeAsString(@Nonnull Node aNode)
XMLWriterSettings.DEFAULT_XML_SETTINGS. This is a specialized
version of getNodeAsString(Node, IXMLWriterSettings).aNode - The node to be converted to a string. May not be null .@Nullable public static byte[] getNodeAsBytes(@Nonnull Node aNode, @Nonnull IXMLWriterSettings aSettings)
aNode - The node to be converted to a byte array. May not be
null.aSettings - The XML writer settings to be used. May not be null.@Nullable public static byte[] getNodeAsBytes(@Nonnull Node aNode)
XMLWriterSettings.DEFAULT_XML_SETTINGS. This is a specialized
version of getNodeAsBytes(Node, IXMLWriterSettings).aNode - The node to be converted to a byte array. May not be
null .Copyright © 2014–2019 Philip Helger. All rights reserved.