com.ebmwebsourcing.wsstar.common.utils
Class WsstarCommonUtils

java.lang.Object
  extended by com.ebmwebsourcing.wsstar.common.utils.WsstarCommonUtils

public final class WsstarCommonUtils
extends java.lang.Object


Method Summary
static org.w3c.dom.Document convertFromFiletoDocument(java.io.File file)
          convert xml File loaded as File Java object to Document Java object
static javax.xml.parsers.DocumentBuilder getDefaultDocumentBuilder()
           DocumentBuilder as thread local, supporting XML namespaces.
static javax.xml.transform.Transformer getDefaultTransformerFactoryThreadLocal()
           
static java.lang.String getEncoding(org.w3c.dom.Document xmlDocument)
          Return the encoding of the document.
static javax.xml.parsers.DocumentBuilder getJvmDocumentBuilder()
           DocumentBuilder as thread local.
static javax.xml.parsers.DocumentBuilder getNamespaceDocumentBuilder()
           DocumentBuilder as thread local, supporting XML namespaces.
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
 

Method Detail

convertFromFiletoDocument

public static org.w3c.dom.Document convertFromFiletoDocument(java.io.File file)
                                                      throws WsstarCommonException
convert xml File loaded as File Java object to Document Java object

Parameters:
file - Java object to convert
Returns:
Document Representation
Throws:
WsstarCommonException

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 javax.xml.transform.TransformerException
Prettify the node into the output stream.

Parameters:
node -
out -
Throws:
javax.xml.transform.TransformerException
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

getDefaultTransformerFactoryThreadLocal

public static javax.xml.transform.Transformer getDefaultTransformerFactoryThreadLocal()

getJvmDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getJvmDocumentBuilder()

DocumentBuilder as thread local.

The document builder is the one provided by JVM_DOCUMENT_BUILDER_THREAD_LOCAL.


getNamespaceDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getNamespaceDocumentBuilder()

DocumentBuilder as thread local, supporting XML namespaces.

The document builder is the one provided by NAMESPACE_DOCUMENT_BUILDER_THREAD_LOCAL.


getDefaultDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getDefaultDocumentBuilder()

DocumentBuilder as thread local, supporting XML namespaces.

The document builder is the one provided by DEFAULT_DOCUMENT_BUILDER_THREAD_LOCAL.



Copyright © 2011 eBM Websourcing. All Rights Reserved.