Package org.apache.xerces.util
Class DOMUtil
java.lang.Object
org.apache.xerces.util.DOMUtil
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.
- Version:
- $Id: DOMUtil.java 929493 2010-03-31 12:15:17Z mrglavas $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCopies the source tree into the specified place in a destination tree.static DOMExceptioncreateDOMException(short code, Throwable cause) Creates a DOMException.static LSExceptioncreateLSException(short code, Throwable cause) Creates an LSException.static StringgetAnnotation(Node node) static Attrstatic Attrstatic Attr[]static StringgetAttrValue(Element elem, String name) static StringgetAttrValueNS(Element elem, String nsUri, String localName) static StringgetChildText(Node node) Returns the concatenated child text of the specified node.static DocumentgetDocument(Node node) static ElementgetFirstChildElement(Node parent) Finds and returns the first child element node.static ElementgetFirstChildElement(Node parent, String elemName) Finds and returns the first child node with the given name.static ElementgetFirstChildElement(Node parent, String[] elemNames) Finds and returns the first child node with the given name.static ElementgetFirstChildElement(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 ElementgetFirstChildElementNS(Node parent, String[][] elemNames) Finds and returns the first child node with the given qualified name.static ElementgetFirstChildElementNS(Node parent, String uri, String localpart) Finds and returns the first child node with the given qualified name.static ElementgetFirstVisibleChildElement(Node parent) Finds and returns the first visible child element node.static ElementgetFirstVisibleChildElement(Node parent, Hashtable hiddenNodes) Finds and returns the first visible child element node.static ElementgetLastChildElement(Node parent) Finds and returns the last child element node.static ElementgetLastChildElement(Node parent, String elemName) Finds and returns the last child node with the given name.static ElementgetLastChildElement(Node parent, String[] elemNames) Finds and returns the last child node with the given name.static ElementgetLastChildElement(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 ElementgetLastChildElementNS(Node parent, String[][] elemNames) Finds and returns the last child node with the given qualified name.static ElementgetLastChildElementNS(Node parent, String uri, String localpart) Finds and returns the last child node with the given qualified name.static ElementgetLastVisibleChildElement(Node parent) Finds and returns the last visible child element node.static ElementgetLastVisibleChildElement(Node parent, Hashtable hiddenNodes) Finds and returns the last visible child element node.static StringgetLocalName(Node node) returns local name of this element if not null, otherwise returns the name of the nodestatic Stringstatic StringgetNamespaceURI(Node node) static ElementgetNextSiblingElement(Node node) Finds and returns the next sibling element node.static ElementgetNextSiblingElement(Node node, String elemName) Finds and returns the next sibling node with the given name.static ElementgetNextSiblingElement(Node node, String[] elemNames) Finds and returns the next sibling node with the given name.static ElementgetNextSiblingElement(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 ElementgetNextSiblingElementNS(Node node, String[][] elemNames) Finds and returns the next sibling node with the given qualified name.static ElementgetNextSiblingElementNS(Node node, String uri, String localpart) Finds and returns the next sibling node with the given qualified name.static Elementstatic ElementgetNextVisibleSiblingElement(Node node, Hashtable hiddenNodes) static Elementstatic Stringstatic Elementstatic StringgetSyntheticAnnotation(Node node) static Stringstatic booleanstatic booleanstatic voidstatic voidstatic voidsetVisible(Node node) static voidsetVisible(Node node, Hashtable hiddenNodes)
-
Constructor Details
-
DOMUtil
protected DOMUtil()This class cannot be instantiated.
-
-
Method Details
-
copyInto
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
-
getFirstChildElement
Finds and returns the first child element node. -
getFirstVisibleChildElement
Finds and returns the first visible child element node. -
getFirstVisibleChildElement
Finds and returns the first visible child element node. -
getLastChildElement
Finds and returns the last child element node. Overload previous method for non-Xerces node impl. -
getLastVisibleChildElement
Finds and returns the last visible child element node. -
getLastVisibleChildElement
Finds and returns the last visible child element node. Overload previous method for non-Xerces node impl -
getNextSiblingElement
Finds and returns the next sibling element node. -
getNextVisibleSiblingElement
-
getNextVisibleSiblingElement
-
setHidden
-
setHidden
-
setVisible
-
setVisible
-
isHidden
-
isHidden
-
getFirstChildElement
Finds and returns the first child node with the given name. -
getLastChildElement
Finds and returns the last child node with the given name. -
getNextSiblingElement
Finds and returns the next sibling node with the given name. -
getFirstChildElementNS
Finds and returns the first child node with the given qualified name. -
getLastChildElementNS
Finds and returns the last child node with the given qualified name. -
getNextSiblingElementNS
Finds and returns the next sibling node with the given qualified name. -
getFirstChildElement
Finds and returns the first child node with the given name. -
getLastChildElement
Finds and returns the last child node with the given name. -
getNextSiblingElement
Finds and returns the next sibling node with the given name. -
getFirstChildElementNS
Finds and returns the first child node with the given qualified name. -
getLastChildElementNS
Finds and returns the last child node with the given qualified name. -
getNextSiblingElementNS
Finds and returns the next sibling node with the given qualified name. -
getFirstChildElement
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. -
getLastChildElement
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. -
getNextSiblingElement
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. -
getChildText
Returns the concatenated child text of the specified node. This method only looks at the immediate children of typeNode.TEXT_NODEor the children of any child node that is of typeNode.CDATA_SECTION_NODEfor the concatenation.- Parameters:
node- The node to look at.
-
getName
-
getLocalName
returns local name of this element if not null, otherwise returns the name of the node -
getParent
-
getDocument
-
getRoot
-
getAttr
-
getAttrNS
-
getAttrs
-
getValue
-
getAttrValue
-
getAttrValueNS
-
getPrefix
-
getNamespaceURI
-
getAnnotation
-
getSyntheticAnnotation
-
createDOMException
Creates a DOMException. On J2SE 1.4 and above the cause for the exception will be set. -
createLSException
Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
-