org.jboss.soa.esb.dom
Class YADOMUtil

java.lang.Object
  extended by org.jboss.soa.esb.dom.YADOMUtil

public class YADOMUtil
extends java.lang.Object

Yet another set of DOM utility methods.

PLEASE DO NOT USE THIS CLASS OUTSIDE THIS PACKAGE. It will be removed as soon as we find equivalent DOM support methods somewhere else, or find a more appropriate home for these.

Author:
tom.fennelly@jboss.com

Constructor Summary
YADOMUtil()
           
 
Method Summary
static org.w3c.dom.Element addElement(org.w3c.dom.Node parent, java.lang.String elementName)
          Add an Element node to the supplied parent name.
static org.w3c.dom.Document createDocument()
          Create a new W3C Document.
static void removeEmptyAttributes(org.w3c.dom.Element element)
          Remove all attributes having an empty value.
static void serialize(org.w3c.dom.Node node, java.io.File outdir, java.lang.String fileName)
          Serialize the supplied DOM node to the specified file in the specified output directory.
static void serialize(org.w3c.dom.Node node, java.io.OutputStream out)
           
static void serialize(org.w3c.dom.Node node, javax.xml.transform.stream.StreamResult streamRes)
          Serialize the supplied DOM node to the supplied DOM StreamResult instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YADOMUtil

public YADOMUtil()
Method Detail

createDocument

public static org.w3c.dom.Document createDocument()
                                           throws ConfigurationException
Create a new W3C Document.

Handles exceptions etc.

Returns:
The new Document instance.
Throws:
ConfigurationException

addElement

public static org.w3c.dom.Element addElement(org.w3c.dom.Node parent,
                                             java.lang.String elementName)
Add an Element node to the supplied parent name.

Parameters:
parent - The parent to to which the new Element node is to be added.
elementName - The name of the Element to be added.
Returns:
The new Element.

removeEmptyAttributes

public static void removeEmptyAttributes(org.w3c.dom.Element element)
Remove all attributes having an empty value.

Parameters:
element - The element to be processed.

serialize

public static void serialize(org.w3c.dom.Node node,
                             java.io.File outdir,
                             java.lang.String fileName)
                      throws ConfigurationException
Serialize the supplied DOM node to the specified file in the specified output directory.

Parameters:
node - The DOM node to be serialised.
outdir - The directory into which the file is to be serialised.
fileName - The name of the file.
Throws:
ConfigurationException - Unable to serialise the node.

serialize

public static void serialize(org.w3c.dom.Node node,
                             java.io.OutputStream out)
                      throws ConfigurationException
Throws:
ConfigurationException

serialize

public static void serialize(org.w3c.dom.Node node,
                             javax.xml.transform.stream.StreamResult streamRes)
                      throws ConfigurationException
Serialize the supplied DOM node to the supplied DOM StreamResult instance.

Parameters:
node - The DOM node to be serialised.
streamRes - The StreamResult into which the node is to be serialised.
Throws:
ConfigurationException - Unable to serialise the node.