org.apache.xerces.validators.schema
Class XUtil

java.lang.Object
  |
  +--org.apache.xerces.validators.schema.XUtil

public class XUtil
extends java.lang.Object

Some useful utility methods.


Constructor Summary
protected XUtil()
          This class cannot be instantiated.
 
Method Summary
static void copyInto(Node src, Node dest)
          Copies the source tree into the specified place in a destination tree.
static java.lang.String getChildText(Node node)
          Returns the concatenated child text of the specified node.
static Element getFirstChildElement(Node parent)
          Finds and returns the first child element node.
static Element getFirstChildElement(Node parent, java.lang.String elemName)
          Finds and returns the first child node with the given name.
static Element getFirstChildElement(Node parent, java.lang.String[] elemNames)
          Finds and returns the first child node with the given name.
static Element getFirstChildElement(Node parent, java.lang.String elemName, java.lang.String attrName, java.lang.String attrValue)
          Finds and returns the first child node with the given name and attribute name, value pair.
static Element getFirstChildElementNS(Node parent, java.lang.String[][] elemNames)
          Finds and returns the first child node with the given qualified name.
static Element getFirstChildElementNS(Node parent, java.lang.String uri, java.lang.String localpart)
          Finds and returns the first child node with the given qualified name.
static Element getLastChildElement(Node parent)
          Finds and returns the last child element node.
static Element getLastChildElement(Node parent, java.lang.String elemName)
          Finds and returns the last child node with the given name.
static Element getLastChildElement(Node parent, java.lang.String[] elemNames)
          Finds and returns the last child node with the given name.
static Element getLastChildElement(Node parent, java.lang.String elemName, java.lang.String attrName, java.lang.String attrValue)
          Finds and returns the last child node with the given name and attribute name, value pair.
static Element getLastChildElementNS(Node parent, java.lang.String[][] elemNames)
          Finds and returns the last child node with the given qualified name.
static Element getLastChildElementNS(Node parent, java.lang.String uri, java.lang.String localpart)
          Finds and returns the last child node with the given qualified name.
static Element getNextSiblingElement(Node node)
          Finds and returns the next sibling element node.
static Element getNextSiblingElement(Node node, java.lang.String elemName)
          Finds and returns the next sibling node with the given name.
static Element getNextSiblingElement(Node node, java.lang.String[] elemNames)
          Finds and returns the next sibling node with the given name.
static Element getNextSiblingElement(Node node, java.lang.String elemName, java.lang.String attrName, java.lang.String attrValue)
          Finds and returns the next sibling node with the given name and attribute name, value pair.
static Element getNextSiblingElementNS(Node node, java.lang.String[][] elemNames)
          Finds and returns the next sibling node with the given qualified name.
static Element getNextSiblingElementNS(Node node, java.lang.String uri, java.lang.String localpart)
          Finds and returns the next sibling node with the given qualified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XUtil

protected XUtil()
This class cannot be instantiated.
Method Detail

copyInto

public static void copyInto(Node src,
                            Node dest)
                     throws DOMException
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.


getFirstChildElement

public static Element getFirstChildElement(Node parent)
Finds and returns the first child element node.

getLastChildElement

public static Element getLastChildElement(Node parent)
Finds and returns the last child element node.

getNextSiblingElement

public static Element getNextSiblingElement(Node node)
Finds and returns the next sibling element node.

getFirstChildElement

public static Element getFirstChildElement(Node parent,
                                           java.lang.String elemName)
Finds and returns the first child node with the given name.

getLastChildElement

public static Element getLastChildElement(Node parent,
                                          java.lang.String elemName)
Finds and returns the last child node with the given name.

getNextSiblingElement

public static Element getNextSiblingElement(Node node,
                                            java.lang.String elemName)
Finds and returns the next sibling node with the given name.

getFirstChildElementNS

public static Element getFirstChildElementNS(Node parent,
                                             java.lang.String uri,
                                             java.lang.String localpart)
Finds and returns the first child node with the given qualified name.

getLastChildElementNS

public static Element getLastChildElementNS(Node parent,
                                            java.lang.String uri,
                                            java.lang.String localpart)
Finds and returns the last child node with the given qualified name.

getNextSiblingElementNS

public static Element getNextSiblingElementNS(Node node,
                                              java.lang.String uri,
                                              java.lang.String localpart)
Finds and returns the next sibling node with the given qualified name.

getFirstChildElement

public static Element getFirstChildElement(Node parent,
                                           java.lang.String[] elemNames)
Finds and returns the first child node with the given name.

getLastChildElement

public static Element getLastChildElement(Node parent,
                                          java.lang.String[] elemNames)
Finds and returns the last child node with the given name.

getNextSiblingElement

public static Element getNextSiblingElement(Node node,
                                            java.lang.String[] elemNames)
Finds and returns the next sibling node with the given name.

getFirstChildElementNS

public static Element getFirstChildElementNS(Node parent,
                                             java.lang.String[][] elemNames)
Finds and returns the first child node with the given qualified name.

getLastChildElementNS

public static Element getLastChildElementNS(Node parent,
                                            java.lang.String[][] elemNames)
Finds and returns the last child node with the given qualified name.

getNextSiblingElementNS

public static Element getNextSiblingElementNS(Node node,
                                              java.lang.String[][] elemNames)
Finds and returns the next sibling node with the given qualified name.

getFirstChildElement

public static Element getFirstChildElement(Node parent,
                                           java.lang.String elemName,
                                           java.lang.String attrName,
                                           java.lang.String attrValue)
Finds and returns the first child node with the given name and attribute name, value pair.

getLastChildElement

public static Element getLastChildElement(Node parent,
                                          java.lang.String elemName,
                                          java.lang.String attrName,
                                          java.lang.String attrValue)
Finds and returns the last child node with the given name and attribute name, value pair.

getNextSiblingElement

public static Element getNextSiblingElement(Node node,
                                            java.lang.String elemName,
                                            java.lang.String attrName,
                                            java.lang.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.

getChildText

public static java.lang.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.


Copyright 1999-2001 Apache XML Project. All Rights Reserved.