com.beasys.commerce.util
Class DOMHelper
java.lang.Object
|
+--com.beasys.commerce.util.DOMHelper
- public class DOMHelper
- extends java.lang.Object
Method Summary |
static java.lang.String |
extractAttributeValue(org.w3c.dom.Node node,
java.lang.String attribute)
Finds value for an attribute with a given name. |
static org.w3c.dom.Node |
extractNodeByTag(org.w3c.dom.Node node,
java.lang.String tag)
Returns a node matching a given tag. |
static org.w3c.dom.NodeList |
extractNodeListByTag(org.w3c.dom.Node node,
java.lang.String tag)
Returns a nodeList consisting of nodes that match a given tag. |
static java.lang.String |
extractNodeValue(org.w3c.dom.Node node)
Finds node value as string object
Return null if node is not present or the node does not have a value |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
DOMHelper
public DOMHelper()
extractNodeByTag
public static org.w3c.dom.Node extractNodeByTag(org.w3c.dom.Node node,
java.lang.String tag)
throws ApplicationException
- Returns a node matching a given tag. Returned node is a child of a given node.
Returns null if no node has been found, or if the given node is null.
Throws an exception if a given node has more than one child node with a given tag.
- Parameters:
node
- xml node from DOM modeltag
- specifies the name of the node to look for in the DOM model
extractNodeListByTag
public static org.w3c.dom.NodeList extractNodeListByTag(org.w3c.dom.Node node,
java.lang.String tag)
throws ApplicationException
- Returns a nodeList consisting of nodes that match a given tag.
NodeList consists of all subelements of a given element,
which might not be its children.
Returns null if no node has been found, or if the given node is null
- Parameters:
node
- xml node from DOM modeltag
- specifies the name of the node to look for in the DOM model
extractNodeValue
public static java.lang.String extractNodeValue(org.w3c.dom.Node node)
throws ApplicationException
- Finds node value as string object
Return null if node is not present or the node does not have a value
- Parameters:
node
- xml node from DOM model
extractAttributeValue
public static java.lang.String extractAttributeValue(org.w3c.dom.Node node,
java.lang.String attribute)
throws ApplicationException
- Finds value for an attribute with a given name. Attribute belongs to a given node.
Only nodes that are elements will have attributes.
Returns null if the given node is null.
Throws exception if node is not null, but there is no attribute.
- Parameters:
node
- xml node from DOM modelattribute
- the name of the attribute
Copyright © 2000 BEA Systems, Inc. All Rights Reserved