public class

DOMUtil

extends Object
java.lang.Object
   ↳ org.apache.xerces.util.DOMUtil

Class Overview

Some useful utility methods. This class was modified in Xerces2 with a view to abstracting as much as possible away from the representation of the underlying parsed structure (i.e., the DOM). This was done so that, if Xerces ever adopts an in-memory representation more efficient than the DOM (such as a DTM), we should easily be able to convert our schema parsing to utilize it.

Summary

Protected Constructors
DOMUtil()
This class cannot be instantiated.
Public Methods
static void copyInto(Node src, Node dest)
Copies the source tree into the specified place in a destination tree.
static DOMException createDOMException(short code, Throwable cause)
Creates a DOMException.
static LSException createLSException(short code, Throwable cause)
Creates an LSException.
static String getAnnotation(Node node)
static Attr getAttr(Element elem, String name)
static Attr getAttrNS(Element elem, String nsUri, String localName)
static String getAttrValue(Element elem, String name)
static String getAttrValueNS(Element elem, String nsUri, String localName)
static Attr[] getAttrs(Element elem)
static String getChildText(Node node)
Returns the concatenated child text of the specified node.
static Document getDocument(Node node)
static Element getFirstChildElement(Node parent, String elemName, String attrName, String attrValue)
Finds and returns the first child node with the given name and attribute name, value pair.
static Element getFirstChildElement(Node parent)
Finds and returns the first child element node.
static Element getFirstChildElement(Node parent, String elemName)
Finds and returns the first child node with the given name.
static Element getFirstChildElement(Node parent, String[] elemNames)
Finds and returns the first child node with the given name.
static Element getFirstChildElementNS(Node parent, String uri, String localpart)
Finds and returns the first child node with the given qualified name.
static Element getFirstChildElementNS(Node parent, String[][] elemNames)
Finds and returns the first child node with the given qualified name.
static Element getFirstVisibleChildElement(Node parent)
Finds and returns the first visible child element node.
static Element getFirstVisibleChildElement(Node parent, Hashtable hiddenNodes)
Finds and returns the first visible child element node.
static Element getLastChildElement(Node parent, String elemName)
Finds and returns the last child node with the given name.
static Element getLastChildElement(Node parent, String[] elemNames)
Finds and returns the last child node with the given name.
static Element getLastChildElement(Node parent, String elemName, String attrName, String attrValue)
Finds and returns the last child node with the given name and attribute name, value pair.
static Element getLastChildElement(Node parent)
Finds and returns the last child element node.
static Element getLastChildElementNS(Node parent, String[][] elemNames)
Finds and returns the last child node with the given qualified name.
static Element getLastChildElementNS(Node parent, String uri, String localpart)
Finds and returns the last child node with the given qualified name.
static Element getLastVisibleChildElement(Node parent, Hashtable hiddenNodes)
Finds and returns the last visible child element node.
static Element getLastVisibleChildElement(Node parent)
Finds and returns the last visible child element node.
static String getLocalName(Node node)
returns local name of this element if not null, otherwise returns the name of the node
static String getName(Node node)
static String getNamespaceURI(Node node)
static Element getNextSiblingElement(Node node, String[] elemNames)
Finds and returns the next sibling node with the given name.
static Element getNextSiblingElement(Node node, String elemName, String attrName, String attrValue)
Finds and returns the next sibling node with the given name and attribute name, value pair.
static Element getNextSiblingElement(Node node, String elemName)
Finds and returns the next sibling node with the given name.
static Element getNextSiblingElement(Node node)
Finds and returns the next sibling element node.
static Element getNextSiblingElementNS(Node node, String uri, String localpart)
Finds and returns the next sibling node with the given qualified name.
static Element getNextSiblingElementNS(Node node, String[][] elemNames)
Finds and returns the next sibling node with the given qualified name.
static Element getNextVisibleSiblingElement(Node node, Hashtable hiddenNodes)
static Element getNextVisibleSiblingElement(Node node)
static Element getParent(Element elem)
static String getPrefix(Node node)
static Element getRoot(Document doc)
static String getSyntheticAnnotation(Node node)
static String getValue(Attr attribute)
static boolean isHidden(Node node, Hashtable hiddenNodes)
static boolean isHidden(Node node)
static void setHidden(Node node)
static void setHidden(Node node, Hashtable hiddenNodes)
static void setVisible(Node node, Hashtable hiddenNodes)
static void setVisible(Node node)
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected DOMUtil ()

This class cannot be instantiated.

Public Methods

public static void copyInto (Node src, Node dest)

Copies the source tree into the specified place in a destination tree. The source node and its children are appended as children of the destination node.

Note: This is an iterative implementation.

Throws
DOMException

public static DOMException createDOMException (short code, Throwable cause)

Creates a DOMException. On J2SE 1.4 and above the cause for the exception will be set.

public static LSException createLSException (short code, Throwable cause)

Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.

public static String getAnnotation (Node node)

public static Attr getAttr (Element elem, String name)

public static Attr getAttrNS (Element elem, String nsUri, String localName)

public static String getAttrValue (Element elem, String name)

public static String getAttrValueNS (Element elem, String nsUri, String localName)

public static Attr[] getAttrs (Element elem)

public static String getChildText (Node node)

Returns the concatenated child text of the specified node. This method only looks at the immediate children of type Node.TEXT_NODE or the children of any child node that is of type Node.CDATA_SECTION_NODE for the concatenation.

Parameters
node The node to look at.

public static Document getDocument (Node node)

public static Element getFirstChildElement (Node parent, String elemName, String attrName, String attrValue)

Finds and returns the first child node with the given name and attribute name, value pair.

public static Element getFirstChildElement (Node parent)

Finds and returns the first child element node.

public static Element getFirstChildElement (Node parent, String elemName)

Finds and returns the first child node with the given name.

public static Element getFirstChildElement (Node parent, String[] elemNames)

Finds and returns the first child node with the given name.

public static Element getFirstChildElementNS (Node parent, String uri, String localpart)

Finds and returns the first child node with the given qualified name.

public static Element getFirstChildElementNS (Node parent, String[][] elemNames)

Finds and returns the first child node with the given qualified name.

public static Element getFirstVisibleChildElement (Node parent)

Finds and returns the first visible child element node.

public static Element getFirstVisibleChildElement (Node parent, Hashtable hiddenNodes)

Finds and returns the first visible child element node.

public static Element getLastChildElement (Node parent, String elemName)

Finds and returns the last child node with the given name.

public static Element getLastChildElement (Node parent, String[] elemNames)

Finds and returns the last child node with the given name.

public static Element getLastChildElement (Node parent, String elemName, String attrName, String attrValue)

Finds and returns the last child node with the given name and attribute name, value pair.

public static Element getLastChildElement (Node parent)

Finds and returns the last child element node. Overload previous method for non-Xerces node impl.

public static Element getLastChildElementNS (Node parent, String[][] elemNames)

Finds and returns the last child node with the given qualified name.

public static Element getLastChildElementNS (Node parent, String uri, String localpart)

Finds and returns the last child node with the given qualified name.

public static Element getLastVisibleChildElement (Node parent, Hashtable hiddenNodes)

Finds and returns the last visible child element node. Overload previous method for non-Xerces node impl

public static Element getLastVisibleChildElement (Node parent)

Finds and returns the last visible child element node.

public static String getLocalName (Node node)

returns local name of this element if not null, otherwise returns the name of the node

public static String getName (Node node)

public static String getNamespaceURI (Node node)

public static Element getNextSiblingElement (Node node, String[] elemNames)

Finds and returns the next sibling node with the given name.

public static Element getNextSiblingElement (Node node, String elemName, String attrName, String attrValue)

Finds and returns the next sibling node with the given name and attribute name, value pair. Since only elements have attributes, the node returned will be of type Node.ELEMENT_NODE.

public static Element getNextSiblingElement (Node node, String elemName)

Finds and returns the next sibling node with the given name.

public static Element getNextSiblingElement (Node node)

Finds and returns the next sibling element node.

public static Element getNextSiblingElementNS (Node node, String uri, String localpart)

Finds and returns the next sibling node with the given qualified name.

public static Element getNextSiblingElementNS (Node node, String[][] elemNames)

Finds and returns the next sibling node with the given qualified name.

public static Element getNextVisibleSiblingElement (Node node, Hashtable hiddenNodes)

public static Element getNextVisibleSiblingElement (Node node)

public static Element getParent (Element elem)

public static String getPrefix (Node node)

public static Element getRoot (Document doc)

public static String getSyntheticAnnotation (Node node)

public static String getValue (Attr attribute)

public static boolean isHidden (Node node, Hashtable hiddenNodes)

public static boolean isHidden (Node node)

public static void setHidden (Node node)

public static void setHidden (Node node, Hashtable hiddenNodes)

public static void setVisible (Node node, Hashtable hiddenNodes)

public static void setVisible (Node node)