Package com.meterware.httpunit
Class NodeUtils
- java.lang.Object
-
- com.meterware.httpunit.NodeUtils
-
public class NodeUtils extends java.lang.Object
Some common utilities for manipulating DOM nodes.
-
-
Constructor Summary
Constructors Constructor Description NodeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
asText(org.w3c.dom.NodeList rootNodes)
Converts the DOM trees rooted at the specified nodes to text, ignoring any HTML tags.static int
getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName, int defaultValue)
get the attribute with the given name from the given node as an int valuestatic java.lang.String
getNodeAttribute(org.w3c.dom.Node node, java.lang.String attributeName)
get the attribute with the given name from the given nodestatic java.lang.String
getNodeAttribute(org.w3c.dom.Node node, java.lang.String attributeName, java.lang.String defaultValue)
get the attribute with the given name from the given nodestatic boolean
isNodeAttributePresent(org.w3c.dom.Node node, java.lang.String attributeName)
check whether the given Attribute in the Node is Present
-
-
-
Method Detail
-
getAttributeValue
public static int getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName, int defaultValue)
get the attribute with the given name from the given node as an int value- Parameters:
node
- - the node to look inattributeName
- - the attribute's name to look fordefaultValue
-- Returns:
- - the value - defaultValue as default
-
getNodeAttribute
public static java.lang.String getNodeAttribute(org.w3c.dom.Node node, java.lang.String attributeName)
get the attribute with the given name from the given node- Parameters:
node
- - the node to look inattributeName
- - the attribute's name to look for- Returns:
- - the value - "" as default
-
getNodeAttribute
public static java.lang.String getNodeAttribute(org.w3c.dom.Node node, java.lang.String attributeName, java.lang.String defaultValue)
get the attribute with the given name from the given node- Parameters:
node
- - the node to look inattributeName
- - the attribute's name to look fordefaultValue
-- Returns:
- - the value - defaultValue as default
-
isNodeAttributePresent
public static boolean isNodeAttributePresent(org.w3c.dom.Node node, java.lang.String attributeName)
check whether the given Attribute in the Node is Present- Parameters:
node
- - the node to checkattributeName
- - the attribute name to check- Returns:
- true if the attribute is present
-
asText
public static java.lang.String asText(org.w3c.dom.NodeList rootNodes)
Converts the DOM trees rooted at the specified nodes to text, ignoring any HTML tags.
-
-