|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.nds.dirxml.util.DxDOMUtil
XdsUtil
is a utility class for performing various common
and useful DOM operations that are not built into the DOM specification
Field Summary | |
static String |
TAG_WILDCARD
Wildcard value that can be used for and of the ByTagName functions |
Constructor Summary | |
DxDOMUtil()
|
Method Summary | |
static Document |
cloneDocument(Document doc)
Creates clone of a document NOTE: only clones the tree structure, ie. ignores any document attributes |
static Node |
cloneSubtree(Document targetDoc,
Node sourceRoot)
Clone a subtree, possibly into another document |
static boolean |
copyAttributeNS(Element src,
String attrNamespaceURI,
String attrLocalName,
Element dest)
Copy an attribute from one element to another, but only if the attribute has a non-empty value |
static boolean |
copyAttributeNS(Element src,
String srcAttrNamespaceURI,
String srcAttrLocalName,
Element dest,
String destAttrNamespaceURI,
String destAttrQName)
Copy an attribute from one element to another, with an new attribute name, but only if the attribute has a non-empty value |
static Element[] |
elementArrayListToElementArray(ArrayList arrayList)
creates an array of Elements from a ArrayList containing only elements |
static void |
ensureDOMImpl(XmlDocument src)
Conditionally convert the passed document to the DirXML DOM implementation. |
static String |
getAssociationState(Element element)
Get the first association state found under element from a NodeList |
static String |
getAssociationValue(Element element)
Get the first association value found under element |
static Element[] |
getChildElements(Node node)
Get all child elements of a node |
static Element[] |
getChildElementsByTagNameNS(Node node,
String namespaceURI,
String localName)
Get the all child elements of a node with a particular tag name |
static Element[] |
getChildElementsByTagNameWithAttrNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName)
Get all child element of a node with a particular tag name and a particular non-empty attribute |
static Element[] |
getChildElementsByTagNameWithAttrValueIgnoreCaseNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get all child elements of a node with a particular tag name and a particular attribute/value pair (value is not case sensitive) |
static Element[] |
getChildElementsByTagNameWithAttrValueNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get all child elements of a node with a particular tag name and a particular attribute/value pair (value is case sensitive) |
static String |
getChildText(Node node)
Get the string value of the concatenation of all the child text nodes |
static NodeList |
getElementsByTagNameNS(Node node,
String namespaceURI,
String localName)
Get all descendent elements of a node with a particular tag name |
static Element[] |
getElementsByTagNameWithAttrNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName)
Get all descendent elements of an node with a particular tag name and a particular non-empty attribute |
static Element[] |
getElementsByTagNameWithAttrValueNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get all descendent elements of an node with a particular tag name and a particular attribute/value pair (value is case sensitive) |
static Element |
getFirstAncestorElementByTagNameNS(Node node,
String namespaceURI,
String localName)
Get the nearest ancestor element of an node with a particular tag name |
static Element |
getFirstAncestorElementByTagNameWithAttrNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName)
Get the nearest ancestor element of an node with a particular tag name and a particular non-empty attribute |
static Element |
getFirstChildElement(Node node)
Get the first child element of a node |
static Element |
getFirstChildElementByTagNameNS(Node node,
String namespaceURI,
String localName)
Get the first child element of a node with a particular tag name |
static Element |
getFirstChildElementByTagNameWithAttrValueIgnoreCaseNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get the first child element of a node with a particular tag name and a particular attribute/value pair (value is not case sensitive) |
static Element |
getFirstChildElementByTagNameWithAttrValueNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get the first child element of a node with a particular tag name and a particular attribute/value pair (value is case sensitive) |
static Element |
getFirstElementByTagNameNS(Node node,
String namespaceURI,
String localName)
Get first descendent element of an node with a particular tag name |
static Element |
getFirstElementByTagNameWithAttrValueNS(Node node,
String namespaceURI,
String localName,
String attrNamespaceURI,
String attrLocalName,
String attrValue)
Get the first descendent elements of an node with a particular tag name and a particular attribute/value pair (value is case sensitive) |
static Element |
getFirstValue(Node node,
String attrName)
Get the first value element for a given attribute |
static String |
getNodeText(Node node)
Get the string value for a node (as defined by XPath) |
static Date |
getTimestamp(Element element)
Get the timestamp for the element |
static int |
getTimestampEventCount(Element element)
Get the timestamp event count for the element |
static void |
graftSubtree(Node parent,
Node sourceRoot)
Graft a cloned subtree, possibly into another document |
static Node[] |
nodeListToNodeArray(NodeList list)
creates an array of nodes from a NodeList |
static void |
removeAllChildren(Node node)
Remove all the children of a node |
static void |
removeChildElementsByTagNameNS(Node node,
String namespaceURI,
String localName)
Remove all child elements of a node with a particular tag name |
static Element |
renameElementNS(Element element,
String namespaceURI,
String qname)
Rename an element (actually replaces the element with a new one that has the same attributes and children |
static void |
setNodeText(Node node,
String text)
Set the string value for a node (as defined by XPath) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String TAG_WILDCARD
Constructor Detail |
public DxDOMUtil()
Method Detail |
public static String getNodeText(Node node)
node
- the node
public static String getChildText(Node node)
node
- the node
public static void setNodeText(Node node, String text)
node
- the nodetext
- the desired text value of the nodepublic static Element getFirstChildElement(Node node)
node
- the node
public static Element getFirstChildElementByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the namespace URIlocalName
- the localName
public static Element getFirstChildElementByTagNameWithAttrValueNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static Element getFirstChildElementByTagNameWithAttrValueIgnoreCaseNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static Element[] getChildElements(Node node)
node
- the node
public static Element[] getChildElementsByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the namespace URIlocalName
- the localName
public static Element[] getChildElementsByTagNameWithAttrNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localName
public static Element[] getChildElementsByTagNameWithAttrValueNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static Element[] getChildElementsByTagNameWithAttrValueIgnoreCaseNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static NodeList getElementsByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localName
public static Element[] getElementsByTagNameWithAttrNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localName
public static Element[] getElementsByTagNameWithAttrValueNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static void removeChildElementsByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNamepublic static Element getFirstElementByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localName
public static Element getFirstElementByTagNameWithAttrValueNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName, String attrValue)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNameattrValue
- the attribute value
public static Node cloneSubtree(Document targetDoc, Node sourceRoot)
targetDoc
- target document for the cloned documentsourceRoot
- root of subtree to clone
public static void graftSubtree(Node parent, Node sourceRoot)
parent
- target parentsourceRoot
- root of subtree to clonepublic static Document cloneDocument(Document doc)
doc
- document to clone
public static Element renameElementNS(Element element, String namespaceURI, String qname)
element
- element to be renamednamespaceURI
- the new namespace URIqname
- new qname
public static void removeAllChildren(Node node)
node
- the nodepublic static Element getFirstAncestorElementByTagNameNS(Node node, String namespaceURI, String localName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localName
public static Element getFirstAncestorElementByTagNameWithAttrNS(Node node, String namespaceURI, String localName, String attrNamespaceURI, String attrLocalName)
node
- the nodenamespaceURI
- the element namespace URIlocalName
- the element localNameattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localName
public static Node[] nodeListToNodeArray(NodeList list)
list
- the nodelist
public static Element[] elementArrayListToElementArray(ArrayList arrayList)
arrayList
- the nodelist
public static String getAssociationValue(Element element)
element
- the element
public static String getAssociationState(Element element)
element
- an element
public static Element getFirstValue(Node node, String attrName)
node
- the node to start atattrName
- the attribute name
public static boolean copyAttributeNS(Element src, String attrNamespaceURI, String attrLocalName, Element dest)
src
- source elementattrNamespaceURI
- the attr namespace URIattrLocalName
- the attr localNamedest
- destination element
public static boolean copyAttributeNS(Element src, String srcAttrNamespaceURI, String srcAttrLocalName, Element dest, String destAttrNamespaceURI, String destAttrQName)
src
- source elementsrcAttrNamespaceURI
- the src attr namespace URIsrcAttrLocalName
- the src attr localNamedest
- destination elementdestAttrNamespaceURI
- the dest attr namespace URIdestAttrQName
- the dest attr qName
public static void ensureDOMImpl(XmlDocument src)
src
- documentpublic static Date getTimestamp(Element element)
element
- the element
public static int getTimestampEventCount(Element element)
element
- the element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |