|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.util.xml.DomUtils
public abstract class DomUtils
Convenience methods for working with the DOM API, in particular for working with DOM Nodes and DOM Elements.
Node,
Element| Constructor Summary | |
|---|---|
DomUtils()
|
|
| Method Summary | |
|---|---|
static ContentHandler |
createContentHandler(Node node)
Returns a SAX ContentHandler that transforms callback calls to DOM Nodes. |
static Element |
getChildElementByTagName(Element ele,
String childEleName)
Utility method that returns the first child element identified by its name. |
static List<Element> |
getChildElements(Element ele)
Retrieve all child elements of the given DOM element |
static List<Element> |
getChildElementsByTagName(Element ele,
String childEleName)
Retrieve all child elements of the given DOM element that match the given element name. |
static List<Element> |
getChildElementsByTagName(Element ele,
String[] childEleNames)
Retrieve all child elements of the given DOM element that match any of the given element names. |
static String |
getChildElementValueByTagName(Element ele,
String childEleName)
Utility method that returns the first child element value identified by its name. |
static String |
getTextValue(Element valueEle)
Extract the text value from the given DOM element, ignoring XML comments. |
static boolean |
nodeNameEquals(Node node,
String desiredName)
Namespace-aware equals comparison. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DomUtils()
| Method Detail |
|---|
public static List<Element> getChildElementsByTagName(Element ele,
String[] childEleNames)
getElementsByTagName method).
ele - the DOM element to analyzechildEleNames - the child element names to look for
org.w3c.dom.Element instancesElement,
Element.getElementsByTagName(java.lang.String)
public static List<Element> getChildElementsByTagName(Element ele,
String childEleName)
getElementsByTagName method).
ele - the DOM element to analyzechildEleName - the child element name to look for
org.w3c.dom.Element instancesElement,
Element.getElementsByTagName(java.lang.String)
public static Element getChildElementByTagName(Element ele,
String childEleName)
ele - the DOM element to analyzechildEleName - the child element name to look for
org.w3c.dom.Element instance, or null if none found
public static String getChildElementValueByTagName(Element ele,
String childEleName)
ele - the DOM element to analyzechildEleName - the child element name to look for
null if no child element foundpublic static List<Element> getChildElements(Element ele)
ele - the DOM element to analyze
org.w3c.dom.Element instancespublic static String getTextValue(Element valueEle)
Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes.
CharacterData,
EntityReference,
Comment
public static boolean nodeNameEquals(Node node,
String desiredName)
true if either Node.getLocalName() or Node.getNodeName() equals desiredName, otherwise returns false.
public static ContentHandler createContentHandler(Node node)
ContentHandler that transforms callback calls to DOM Nodes.
node - the node to publish events to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||