JBoss Common Classes 2.2.17.GA

org.jboss.util.xml
Class DOMWriter

java.lang.Object
  extended by org.jboss.util.xml.DOMWriter

public class DOMWriter
extends Object

Traverse a DOM tree in order to print a document that is parsed.

Author:
Andy Clark, IBM, Thomas.Diesler@jboss.org

Constructor Summary
DOMWriter(OutputStream stream)
           
DOMWriter(OutputStream stream, String charsetName)
           
DOMWriter(Writer w)
           
DOMWriter(Writer w, String charsetName)
           
 
Method Summary
 boolean isCanonical()
           
 boolean isIgnoreWhitespace()
           
 boolean isPrettyprint()
           
 boolean isWriteXMLDeclaration()
           
static String normalize(String s, boolean canonical)
          Normalizes the given string.
 void print(Node node)
           
static String printNode(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMWriter

public DOMWriter(Writer w)

DOMWriter

public DOMWriter(Writer w,
                 String charsetName)

DOMWriter

public DOMWriter(OutputStream stream)

DOMWriter

public DOMWriter(OutputStream stream,
                 String charsetName)
Method Detail

printNode

public static String printNode(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(Node node)

normalize

public static String normalize(String s,
                               boolean canonical)
Normalizes the given string.


JBoss Common Classes 2.2.17.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.