Package org.jboss.common.beans.property
Class DOMWriter
- java.lang.Object
-
- org.jboss.common.beans.property.DOMWriter
-
public class DOMWriter extends java.lang.Object
Traverse a DOM tree in order to print a document that is parsed.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
canonical
private java.lang.String
charsetName
private boolean
completeNamespaces
private java.lang.String
currentDefaultNamespace
private boolean
ignoreWhitespace
private java.io.PrintWriter
out
private int
prettyIndent
private boolean
prettyprint
private org.w3c.dom.Node
rootNode
private boolean
writeXMLDeclaration
private boolean
wroteXMLDeclaration
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
getNamespaceURI(java.lang.String prefix, org.w3c.dom.Element element, org.w3c.dom.Node stopNode)
boolean
isCanonical()
private boolean
isEndMarkerIndented(org.w3c.dom.Node node)
boolean
isIgnoreWhitespace()
boolean
isPrettyprint()
boolean
isWriteXMLDeclaration()
static java.lang.String
normalize(java.lang.String s, boolean canonical)
Normalizes the given string.void
print(org.w3c.dom.Node node)
private void
printInternal(org.w3c.dom.Node node, boolean indentEndMarker)
static java.lang.String
printNode(org.w3c.dom.Node node, boolean prettyprint)
Print a node with explicit prettyprinting.DOMWriter
setCanonical(boolean canonical)
Set wheter entities should appear in their canonical form.DOMWriter
setCompleteNamespaces(boolean complete)
Set wheter subelements should have their namespaces completed.DOMWriter
setIgnoreWhitespace(boolean ignoreWhitespace)
Set whether whitespace should be ignored.DOMWriter
setPrettyprint(boolean prettyprint)
Set wheter element should be indented.DOMWriter
setWriteXMLDeclaration(boolean flag)
Set wheter the XML declaration should be written.private org.w3c.dom.Attr[]
sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes.
-
-
-
Field Detail
-
out
private java.io.PrintWriter out
-
canonical
private boolean canonical
-
prettyprint
private boolean prettyprint
-
writeXMLDeclaration
private boolean writeXMLDeclaration
-
ignoreWhitespace
private boolean ignoreWhitespace
-
charsetName
private java.lang.String charsetName
-
prettyIndent
private int prettyIndent
-
wroteXMLDeclaration
private boolean wroteXMLDeclaration
-
rootNode
private org.w3c.dom.Node rootNode
-
completeNamespaces
private boolean completeNamespaces
-
currentDefaultNamespace
private java.lang.String currentDefaultNamespace
-
-
Method Detail
-
printNode
public static java.lang.String printNode(org.w3c.dom.Node node, boolean prettyprint)
Print a node with explicit prettyprinting. The defaults for all other DOMWriter properties apply.
-
isCanonical
public boolean isCanonical()
-
setCanonical
public DOMWriter setCanonical(boolean canonical)
Set wheter entities should appear in their canonical form. The default is false.
-
isIgnoreWhitespace
public boolean isIgnoreWhitespace()
-
setIgnoreWhitespace
public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
Set whether whitespace should be ignored. The default is false.
-
setCompleteNamespaces
public DOMWriter setCompleteNamespaces(boolean complete)
Set wheter subelements should have their namespaces completed. Setting this to false may lead to invalid XML fragments. The default is true.
-
isPrettyprint
public boolean isPrettyprint()
-
setPrettyprint
public DOMWriter setPrettyprint(boolean prettyprint)
Set wheter element should be indented. The default is false.
-
isWriteXMLDeclaration
public boolean isWriteXMLDeclaration()
-
setWriteXMLDeclaration
public DOMWriter setWriteXMLDeclaration(boolean flag)
Set wheter the XML declaration should be written. The default is false.
-
print
public void print(org.w3c.dom.Node node)
-
printInternal
private void printInternal(org.w3c.dom.Node node, boolean indentEndMarker)
-
getNamespaceURI
private java.lang.String getNamespaceURI(java.lang.String prefix, org.w3c.dom.Element element, org.w3c.dom.Node stopNode)
-
isEndMarkerIndented
private boolean isEndMarkerIndented(org.w3c.dom.Node node)
-
sortAttributes
private org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes.
-
normalize
public static java.lang.String normalize(java.lang.String s, boolean canonical)
Normalizes the given string.
-
-