|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.util.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 List |
getChildElementsByTagName(Element ele,
String childEleName)
Retrieve all child elements of the given DOM element that match the given element name. |
static List |
getChildElementsByTagName(Element ele,
String childEleName,
boolean localName)
Retrieve all child elements of the given DOM element that match the given element name. |
static String |
getElementAttribute(Element ele,
String attributeName)
|
static String |
getElementAttribute(Element ele,
String attributeName,
String defaultValue)
Gets the attribute value from the element. |
static boolean |
getElementAttributeAsBoolean(Element ele,
String attributeName,
boolean defaultValue)
|
static String |
getTextValue(Element valueEle)
Extract the text value from the given DOM element, ignoring XML comments. |
static String |
getTrimmedTextValue(Element valueEle)
Retruns the trimmed text value of the DOM element. |
| 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 String getElementAttribute(Element ele,
String attributeName)
public static String getElementAttribute(Element ele,
String attributeName,
String defaultValue)
null
or is an empty string, will return the defaultValue.
public static boolean getElementAttributeAsBoolean(Element ele,
String attributeName,
boolean defaultValue)
public static List 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 List getChildElementsByTagName(Element ele,
String childEleName,
boolean localName)
getElementsByTagName method).
Can select whether or not to compare against the local name of
the Element
ele - the DOM element to analyzechildEleName - the child element name to look forlocalName - whether to compare against the local node name
org.w3c.dom.Element instancesElement,
Element.getElementsByTagName(java.lang.String)public static String getTrimmedTextValue(Element valueEle)
getTextValue(org.w3c.dom.Element)public static String getTextValue(Element valueEle)
Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes.
CharacterData,
EntityReference,
Comment
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||