© 2002 BEA Systems, Inc.


com.bea.p13n.xml.util
Class DomHelper

java.lang.Object
  |
  +--com.bea.p13n.xml.util.DomHelper

public class DomHelper
extends java.lang.Object


Constructor Summary
DomHelper()
           
 
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 and that are descendant elements of a given node.
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
static java.lang.String getTagName(org.w3c.dom.Element e)
          Get the non-namespace-prefixed tag name of an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomHelper

public DomHelper()
Method Detail

extractNodeByTag

public static org.w3c.dom.Node extractNodeByTag(org.w3c.dom.Node node,
                                                java.lang.String tag)
                                         throws DomException
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.

Parameters:
node - xml node from DOM model
tag - specifies the name of the node to look for in the DOM model
Throws:
DomException - if a given node has more than one child node with a given tag.

extractNodeListByTag

public static org.w3c.dom.NodeList extractNodeListByTag(org.w3c.dom.Node node,
                                                        java.lang.String tag)
                                                 throws DomException
Returns a nodeList consisting of nodes that match a given tag and that are descendant elements of a given node. Elements might not be node's direct children, but few levels deep. Returns null if no subelements have been found, or if the given node is null

Parameters:
node - xml node from DOM model
tag - 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 DomException
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 DomException
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 or attribute does not exist

Parameters:
node - xml node from DOM model
attribute - the name of the attribute
Throws:
DomException - if given node is not an element.

getTagName

public static java.lang.String getTagName(org.w3c.dom.Element e)
Get the non-namespace-prefixed tag name of an element.

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved