org.apache.servicemix.jbi.util
Class DOMUtil

java.lang.Object
  extended by org.apache.servicemix.jbi.util.DOMUtil

public final class DOMUtil
extends Object

A collection of W3C DOM helper methods

Version:
$Revision: 564607 $

Method Summary
static void addChildElement(Element element, String name, Object textValue)
          Adds the child element with the given text
static String asIndentedXML(Node node)
          A helper method useful for debugging and logging which will convert the given DOM node into XML text
static String asXML(Node node)
          A helper method useful for debugging and logging which will convert the given DOM node into XML text
static void copyAttributes(Element from, Element to)
          Copy the attribues on one element to the other
static QName createQName(Element element, String qualifiedName)
          Creates a QName instance from the given namespace context for the given qualifiedName
static DocumentBuilder getBuilder()
           
static String getElementText(Element element)
          Returns the text of the element
static Element getFirstChildElement(Node parent)
          Get the first child element
static Element getNextSiblingElement(Element el)
          Get the next sibling element
static QName getQName(Element el)
          Build a QName from the element name
static void moveContent(Element from, Element to)
          Moves the content of the given element to the given element
static Document newDocument()
          Return a new document, ready to populate.
static String recursiveGetAttributeValue(Element element, String attributeName)
          Recursive method to find a given attribute value
static void releaseBuilder(DocumentBuilder builder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getElementText

public static String getElementText(Element element)
Returns the text of the element


moveContent

public static void moveContent(Element from,
                               Element to)
Moves the content of the given element to the given element


copyAttributes

public static void copyAttributes(Element from,
                                  Element to)
Copy the attribues on one element to the other


asXML

public static String asXML(Node node)
                    throws TransformerException
A helper method useful for debugging and logging which will convert the given DOM node into XML text

Throws:
TransformerException

asIndentedXML

public static String asIndentedXML(Node node)
                            throws TransformerException
A helper method useful for debugging and logging which will convert the given DOM node into XML text

Throws:
TransformerException

addChildElement

public static void addChildElement(Element element,
                                   String name,
                                   Object textValue)
Adds the child element with the given text


createQName

public static QName createQName(Element element,
                                String qualifiedName)
Creates a QName instance from the given namespace context for the given qualifiedName

Parameters:
element - the element to use as the namespace context
qualifiedName - the fully qualified name
Returns:
the QName which matches the qualifiedName

recursiveGetAttributeValue

public static String recursiveGetAttributeValue(Element element,
                                                String attributeName)
Recursive method to find a given attribute value


getFirstChildElement

public static Element getFirstChildElement(Node parent)
Get the first child element

Parameters:
parent -
Returns:

getNextSiblingElement

public static Element getNextSiblingElement(Element el)
Get the next sibling element

Parameters:
el -
Returns:

getQName

public static QName getQName(Element el)
Build a QName from the element name

Parameters:
el -
Returns:

getBuilder

public static DocumentBuilder getBuilder()
                                  throws ParserConfigurationException
Throws:
ParserConfigurationException

releaseBuilder

public static void releaseBuilder(DocumentBuilder builder)

newDocument

public static Document newDocument()
                            throws ParserConfigurationException
Return a new document, ready to populate.

Returns:
Throws:
ParserConfigurationException


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