org.ow2.easywsdl.schema.util
Class XMLPrettyPrinter

java.lang.Object
  extended by org.ow2.easywsdl.schema.util.XMLPrettyPrinter

public class XMLPrettyPrinter
extends java.lang.Object

Author:
alouis - eBM WebSourcing, ofabre - eBM WebSourcing

Field Summary
static java.lang.ThreadLocal<javax.xml.transform.TransformerFactory> transformerFactoryThreadLocal
           A thread safe TransformerFactory, based on com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
 
Constructor Summary
XMLPrettyPrinter()
           
 
Method Summary
static java.lang.String getEncoding(org.w3c.dom.Document xmlDocument)
          Return the encoding of the document.
static void prettify(org.w3c.dom.Node node, java.io.OutputStream out, java.lang.String encoding)
          Prettify the node into the output stream.
static java.lang.String prettyPrint(org.w3c.dom.Document xmlDocument)
          parse the xml Document and return it pretty-printed (with correct indentations, etc..).
static java.lang.String prettyPrint(org.w3c.dom.Document xmlDocument, java.lang.String encoding)
          parse the xml String and return it pretty-printed (with correct indentations, etc..)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transformerFactoryThreadLocal

public static final java.lang.ThreadLocal<javax.xml.transform.TransformerFactory> transformerFactoryThreadLocal

A thread safe TransformerFactory, based on com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl

Constructor Detail

XMLPrettyPrinter

public XMLPrettyPrinter()
Method Detail

prettyPrint

public static java.lang.String prettyPrint(org.w3c.dom.Document xmlDocument,
                                           java.lang.String encoding)
parse the xml String and return it pretty-printed (with correct indentations, etc..)

Parameters:
xmlDocument - the xml document to pretty print. Must be non null
encoding - the encoding to use

prettyPrint

public static java.lang.String prettyPrint(org.w3c.dom.Document xmlDocument)
parse the xml Document and return it pretty-printed (with correct indentations, etc..). Use the encoding defined at the parsing or in the document (utf8 is used if no encoding is defined)

Parameters:
xmlDocument - the xml document to pretty print. Must be non null

prettify

public static void prettify(org.w3c.dom.Node node,
                            java.io.OutputStream out,
                            java.lang.String encoding)
                     throws java.lang.Exception
Prettify the node into the output stream.

Parameters:
node -
out -
Throws:
java.lang.Exception

getEncoding

public static java.lang.String getEncoding(org.w3c.dom.Document xmlDocument)
Return the encoding of the document.

Parameters:
xmlDocument -
Returns:
InputEncoding or the XmlEncoding of the document, UTF-8 if not found


Copyright © 2008-2009 Petals Link (previously EBM WebSourcing). All Rights Reserved.