Package com.meterware.httpunit

# Class NodeUtils

java.lang.Object
com.meterware.httpunit.NodeUtils

public class NodeUtils extends Object
Some common utilities for manipulating DOM nodes.

## Constructor Summary

Constructors
Constructor
Description
`NodeUtils()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`asText(NodeList rootNodes)`
Converts the DOM trees rooted at the specified nodes to text, ignoring any HTML tags.
`static int`
`getAttributeValue(Node node, String attributeName, int defaultValue)`
get the attribute with the given name from the given node as an int value
`static String`
`getNodeAttribute(Node node, String attributeName)`
get the attribute with the given name from the given node
`static String`
`getNodeAttribute(Node node, String attributeName, String defaultValue)`
get the attribute with the given name from the given node
`static boolean`
`isNodeAttributePresent(Node node, String attributeName)`
check whether the given Attribute in the Node is Present

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### NodeUtils

public NodeUtils()

## Method Details

### getAttributeValue

public static int getAttributeValue(Node node, 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 in
  `attributeName` - - the attribute's name to look for
  `defaultValue` -
Returns:
  - the value - defaultValue as default

### getNodeAttribute

public static String getNodeAttribute(Node node, String attributeName)
get the attribute with the given name from the given node

Parameters:
  `node` - - the node to look in
  `attributeName` - - the attribute's name to look for
Returns:
  - the value - "" as default

### getNodeAttribute

public static String getNodeAttribute(Node node, String attributeName, String defaultValue)
get the attribute with the given name from the given node

Parameters:
  `node` - - the node to look in
  `attributeName` - - the attribute's name to look for
  `defaultValue` -
Returns:
  - the value - defaultValue as default

### isNodeAttributePresent

public static boolean isNodeAttributePresent(Node node, String attributeName)
check whether the given Attribute in the Node is Present

Parameters:
  `node` - - the node to check
  `attributeName` - - the attribute name to check
Returns:
  true if the attribute is present

### asText

public static String asText(NodeList rootNodes)
Converts the DOM trees rooted at the specified nodes to text, ignoring any HTML tags.