Package com.helger.xml.serialize.write
Class AbstractXMLSerializer<NODETYPE>
java.lang.Object
com.helger.xml.serialize.write.AbstractXMLSerializer<NODETYPE>
- Type Parameters:
NODETYPE- The DOM node type to use
- Direct Known Subclasses:
MicroSerializer,XMLSerializer
Abstract XML serializer implementation that works with IMicroNode and
org.w3c.dom.Node objects.
- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classContains the XML namespace definitions for a single element.protected static final classContains the hierarchy of XML namespaces within a document structure. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe prefix to be used for created namespace prefixes :) (e.g. for "ns0" or "ns1")protected final StringBuilderhelper variable: current indentation.protected final AbstractXMLSerializer.NamespaceStackCurrent stack of namespaces.protected final IXMLWriterSettingsThe serialization settings -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected XMLEmittercreateXMLEmitter(Writer aWriter, IXMLWriterSettings aSettings) protected abstract voidemitNode(XMLEmitter aXMLWriter, NODETYPE aParentNode, NODETYPE aPrevSibling, NODETYPE aNode, NODETYPE aNextSibling) final IXMLWriterSettingsprotected final voidhandlePutNamespaceContextPrefixInRoot(Map<QName, String> aAttrMap) This method handles the case, if all namespace context entries should be emitted on the root element.toString()final voidwrite(NODETYPE aNode, XMLEmitter aXMLEmitter) final voidwrite(NODETYPE aNode, OutputStream aOS) Write the specified node to the specifiedOutputStream.final voidWrite the specified node to the specifiedWriter.
-
Field Details
-
DEFAULT_NAMESPACE_PREFIX_PREFIX
The prefix to be used for created namespace prefixes :) (e.g. for "ns0" or "ns1")- See Also:
-
m_aSettings
The serialization settings -
m_aIndent
helper variable: current indentation. -
m_aNSStack
Current stack of namespaces.
-
-
Constructor Details
-
AbstractXMLSerializer
-
-
Method Details
-
getSettings
-
handlePutNamespaceContextPrefixInRoot
This method handles the case, if all namespace context entries should be emitted on the root element.- Parameters:
aAttrMap- the attribute map to be filled. May not benull.
-
emitNode
-
createXMLEmitter
@Nonnull @OverrideOnDemand protected XMLEmitter createXMLEmitter(@Nonnull @WillNotClose Writer aWriter, @Nonnull IXMLWriterSettings aSettings) -
write
-
write
Write the specified node to the specifiedOutputStream.- Parameters:
aNode- The node to write. May not benull.aOS- The stream to serialize onto. May not benull.
-
write
Write the specified node to the specifiedWriter.- Parameters:
aNode- The node to write. May not benull.aWriter- The writer to serialize onto. May not benull.
-
toString
-