|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jcp.xml.dsig.internal.dom.DOMUtils
public class DOMUtils
Useful static DOM utility methods.
| Method Summary | |
|---|---|
static void |
appendChild(Node parent,
Node child)
Checks if child element has same owner document before appending to the parent, and imports it to the parent's document if necessary. |
static Element |
createElement(Document doc,
String tag,
String nsURI,
String prefix)
Creates an element in the specified namespace, with the specified tag and namespace prefix. |
static String |
getAttributeValue(Element elem,
String name)
Returns the attribute value for the attribute with the specified name. |
static Element |
getFirstChildElement(Node node)
Returns the first child element of the specified node, or null if there is no such element. |
static Element |
getLastChildElement(Node node)
Returns the last child element of the specified node, or null if there is no such element. |
static Element |
getNextSiblingElement(Node node)
Returns the next sibling element of the specified node, or null if there is no such element. |
static String |
getNSPrefix(XMLCryptoContext context,
String nsURI)
Returns the prefix associated with the specified namespace URI |
static Document |
getOwnerDocument(Node node)
Returns the owner document of the specified node. |
static String |
getSignaturePrefix(XMLCryptoContext context)
Returns the prefix associated with the XML Signature namespace URI |
static boolean |
nodesEqual(Node thisNode,
Node otherNode)
Compares 2 nodes for equality. |
static Set<Node> |
nodeSet(NodeList nl)
Returns a Set of Nodes, backed by the specified
NodeList. |
static boolean |
paramsEqual(AlgorithmParameterSpec spec1,
AlgorithmParameterSpec spec2)
|
static void |
removeAllChildren(Node node)
Removes all children nodes from the specified node. |
static void |
setAttribute(Element elem,
String name,
String value)
Sets an element's attribute (using DOM level 2) with the specified value and namespace prefix. |
static void |
setAttributeID(Element elem,
String name,
String value)
Sets an element's attribute (using DOM level 2) with the specified value and namespace prefix AND registers the ID value with the specified element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Document getOwnerDocument(Node node)
node - the node
public static Element createElement(Document doc,
String tag,
String nsURI,
String prefix)
doc - the owner documenttag - the tagnsURI - the namespace URIprefix - the namespace prefix
public static void setAttribute(Element elem,
String name,
String value)
elem - the element to set the attribute onname - the name of the attributevalue - the attribute value. If null, no attribute is set.
public static void setAttributeID(Element elem,
String name,
String value)
elem - the element to set the attribute onname - the name of the attributevalue - the attribute value. If null, no attribute is set.public static Element getFirstChildElement(Node node)
node - the node
NullPointerException - if node == nullpublic static Element getLastChildElement(Node node)
node - the node
NullPointerException - if node == nullpublic static Element getNextSiblingElement(Node node)
node - the node
NullPointerException - if node == null
public static String getAttributeValue(Element elem,
String name)
This works around a limitation of the DOM
Element.getAttributeNode method, which does not distinguish
between an unspecified attribute and an attribute with a value of
"" (it returns "" for both cases).
elem - the element containing the attributename - the name of the attribute
public static Set<Node> nodeSet(NodeList nl)
Nodes, backed by the specified
NodeList.
nl - the NodeList
public static String getNSPrefix(XMLCryptoContext context,
String nsURI)
context - contains the namespace mapnsURI - the namespace URI
public static String getSignaturePrefix(XMLCryptoContext context)
context - contains the namespace map
public static void removeAllChildren(Node node)
node - the parent node whose children are to be removed
public static boolean nodesEqual(Node thisNode,
Node otherNode)
public static void appendChild(Node parent,
Node child)
public static boolean paramsEqual(AlgorithmParameterSpec spec1,
AlgorithmParameterSpec spec2)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||