org.apache.ws.util
Class JaxpUtils

java.lang.Object
  extended byorg.apache.ws.util.JaxpUtils

public abstract class JaxpUtils
extends java.lang.Object

A set of generic JAXP utility methods.

Author:
Ian Springer

Field Summary
static java.lang.ThreadLocal DOCUMENT_BUILDER_FACTORIES
          Thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe).
static java.lang.ThreadLocal TRANSFORMER_FACTORIES
          Thread local that gives each thread its own TransformerFactory (since it is not thread-safe).
 
Constructor Summary
JaxpUtils()
           
 
Method Summary
static org.w3c.dom.Document loadDocument(org.xml.sax.InputSource in_source)
          Loads a DOM Document from an InputSource.
static org.w3c.dom.Document loadDocument(java.io.InputStream in_stream)
          Method to load a DOM Document from an InputStream.
static org.w3c.dom.Document toDocument(java.lang.String xmlString)
          Converts a string containing an XML document into a Document.
static java.lang.String toString(org.w3c.dom.Node node)
          Converts an XML Node into a string containing the corresponding XML.
static java.lang.String toString(org.w3c.dom.Node node, boolean indentOutput)
          Converts an XML Node into a string containing the corresponding XML, optionally pretty-printed with indenting and newlines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSFORMER_FACTORIES

public static java.lang.ThreadLocal TRANSFORMER_FACTORIES
Thread local that gives each thread its own TransformerFactory (since it is not thread-safe).


DOCUMENT_BUILDER_FACTORIES

public static java.lang.ThreadLocal DOCUMENT_BUILDER_FACTORIES
Thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe).

Constructor Detail

JaxpUtils

public JaxpUtils()
Method Detail

loadDocument

public static org.w3c.dom.Document loadDocument(org.xml.sax.InputSource in_source)
                                         throws javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException,
                                                java.io.IOException
Loads a DOM Document from an InputSource.

Parameters:
in_source -
Returns:
Document
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

loadDocument

public static org.w3c.dom.Document loadDocument(java.io.InputStream in_stream)
                                         throws javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException,
                                                java.io.IOException
Method to load a DOM Document from an InputStream.

Parameters:
in_stream -
Returns:
Document
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

toDocument

public static org.w3c.dom.Document toDocument(java.lang.String xmlString)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              org.xml.sax.SAXException,
                                              java.io.IOException
Converts a string containing an XML document into a Document.

Parameters:
xmlString -
Returns:
the W3C DOM document
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

toString

public static java.lang.String toString(org.w3c.dom.Node node)
                                 throws java.lang.Exception
Converts an XML Node into a string containing the corresponding XML. ***NOTE*** requires an XSLT implementation (ie - Xalan) in the classpath at runtime

Parameters:
node - a DOM node
Returns:
String representation of the node
Throws:
java.lang.Exception

toString

public static java.lang.String toString(org.w3c.dom.Node node,
                                        boolean indentOutput)
                                 throws java.lang.Exception
Converts an XML Node into a string containing the corresponding XML, optionally pretty-printed with indenting and newlines. ***NOTE*** requires an XSLT implementation (ie - Xalan) in the classpath at runtime

Parameters:
node - a DOM node
indentOutput - whether or not to indent the output XML
Returns:
String representation of the node
Throws:
java.lang.Exception


Copyright © 2004-2005 Apache Software Foundation. All Rights Reserved.