Package com.twelvemonkeys.xml
Class DOMSerializer
java.lang.Object
com.twelvemonkeys.xml.DOMSerializer
DOMImplementationLS
backed implementation.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/xml/DOMSerializer.java#2 $
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LSOutput
private static final String
private static final String
private final LSSerializer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
DOMSerializer
(OutputStream pStream, String pEncoding) Creates a serializer using the given byte stream and encoding.DOMSerializer
(Writer pStream) Creates a serializer using the given character stream and encoding. -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Serializes the entire document.void
Serializes the given node, along with any subnodes.private void
serializeImpl
(Node pNode, boolean pOmitDecl) void
setPrettyPrint
(boolean pPrettyPrint) Specifies wether the serializer should use indentation and optimize for readability.private void
setXMLDeclaration
(boolean pXMLDeclaration)
-
Field Details
-
PARAM_PRETTY_PRINT
- See Also:
-
PARAM_XML_DECLARATION
- See Also:
-
serializer
-
output
-
-
Constructor Details
-
DOMSerializer
private DOMSerializer() -
DOMSerializer
Creates a serializer using the given byte stream and encoding.- Parameters:
pStream
- the byte stream.pEncoding
- the encoding.- Throws:
IllegalStateException
- if noDOMImplementation
with the right features can be instantiated.
-
DOMSerializer
Creates a serializer using the given character stream and encoding.- Parameters:
pStream
- the characted stream.- Throws:
IllegalStateException
- if noDOMImplementation
with the right features can be instantiated.
-
-
Method Details
-
setPrettyPrint
public void setPrettyPrint(boolean pPrettyPrint) Specifies wether the serializer should use indentation and optimize for readability.Note: This is a hint, and may be ignored by DOM implementations.
- Parameters:
pPrettyPrint
-true
to enable pretty printing
-
getPrettyPrint
public boolean getPrettyPrint() -
setXMLDeclaration
private void setXMLDeclaration(boolean pXMLDeclaration) -
serialize
Serializes the entire document.- Parameters:
pDocument
- the document.
-
serialize
Serializes the given node, along with any subnodes. Will not emit XML declaration.- Parameters:
pNode
- the top node.
-
serializeImpl
-