|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 org.xml.sax.ContentHandler |
createContentHandler(org.w3c.dom.Node node)
Returns a SAX ContentHandler that transforms callback calls to DOM Node s. |
static org.w3c.dom.Element |
getChildElementByTagName(org.w3c.dom.Element ele,
java.lang.String childEleName)
Utility method that returns the first child element identified by its name. |
static java.util.List<org.w3c.dom.Element> |
getChildElements(org.w3c.dom.Element ele)
Retrieve all child elements of the given DOM element |
static java.util.List<org.w3c.dom.Element> |
getChildElementsByTagName(org.w3c.dom.Element ele,
java.lang.String childEleName)
Retrieve all child elements of the given DOM element that match the given element name. |
static java.util.List<org.w3c.dom.Element> |
getChildElementsByTagName(org.w3c.dom.Element ele,
java.lang.String[] childEleNames)
Retrieve all child elements of the given DOM element that match any of the given element names. |
static java.lang.String |
getChildElementValueByTagName(org.w3c.dom.Element ele,
java.lang.String childEleName)
Utility method that returns the first child element value identified by its name. |
static java.lang.String |
getTextValue(org.w3c.dom.Element valueEle)
Extract the text value from the given DOM element, ignoring XML comments. |
static boolean |
nodeNameEquals(org.w3c.dom.Node node,
java.lang.String desiredName)
Namespace-aware equals comparison. |
private static boolean |
nodeNameMatch(org.w3c.dom.Node node,
java.util.Collection desiredNames)
Matches the given node's name and local name against the given desired names. |
private static boolean |
nodeNameMatch(org.w3c.dom.Node node,
java.lang.String desiredName)
Matches the given node's name and local name against the given desired name. |
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 java.util.List<org.w3c.dom.Element> getChildElementsByTagName(org.w3c.dom.Element ele, java.lang.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 java.util.List<org.w3c.dom.Element> getChildElementsByTagName(org.w3c.dom.Element ele, java.lang.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 org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Element ele, java.lang.String childEleName)
ele
- the DOM element to analyzechildEleName
- the child element name to look for
org.w3c.dom.Element
instance, or null
if none foundpublic static java.lang.String getChildElementValueByTagName(org.w3c.dom.Element ele, java.lang.String childEleName)
ele
- the DOM element to analyzechildEleName
- the child element name to look for
null
if no child element foundpublic static java.util.List<org.w3c.dom.Element> getChildElements(org.w3c.dom.Element ele)
ele
- the DOM element to analyze
org.w3c.dom.Element
instancespublic static java.lang.String getTextValue(org.w3c.dom.Element valueEle)
Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes.
CharacterData
,
EntityReference
,
Comment
public static boolean nodeNameEquals(org.w3c.dom.Node node, java.lang.String desiredName)
true
if either Node.getLocalName()
or Node.getNodeName()
equals desiredName
, otherwise returns false
.
public static org.xml.sax.ContentHandler createContentHandler(org.w3c.dom.Node node)
ContentHandler
that transforms callback calls to DOM Node
s.
node
- the node to publish events to
private static boolean nodeNameMatch(org.w3c.dom.Node node, java.lang.String desiredName)
private static boolean nodeNameMatch(org.w3c.dom.Node node, java.util.Collection desiredNames)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |