org.springframework.util.xml
Class DomUtils

java.lang.Object
  extended by org.springframework.util.xml.DomUtils

public abstract class DomUtils
extends Object

Convenience methods for working with the DOM API, in particular for working with DOM Nodes and DOM Elements.

Since:
1.2
Author:
Juergen Hoeller
See Also:
Node, Element

Constructor Summary
DomUtils()
           
 
Method Summary
static List getChildElementsByTagName(Element ele, String childEleName)
          Retrieve all child elements of the given DOM element that match the given element name.
static String getTextValue(Element valueEle)
          Extract the text value from the given DOM element, ignoring XML comments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomUtils

public DomUtils()
Method Detail

getChildElementsByTagName

public static List getChildElementsByTagName(Element ele,
                                             String childEleName)
Retrieve all child elements of the given DOM element that match the given element name. Only look at the direct child level of the given element; do not go into further depth (in contrast to the DOM API's getElementsByTagName method).

Parameters:
ele - the DOM element to analyze
childEleName - the child element name to look for
Returns:
a List of child org.w3c.dom.Element instances
See Also:
Element, Element.getElementsByTagName(java.lang.String)

getTextValue

public static String getTextValue(Element valueEle)
Extract the text value from the given DOM element, ignoring XML comments.

Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes.

See Also:
CharacterData, EntityReference, Comment


Copyright (c) 2002-2005 The Spring Framework Project.