org.jcp.xml.dsig.internal.dom
public class DOMUtils extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
appendChild(org.w3c.dom.Node parent,
org.w3c.dom.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 org.w3c.dom.Element |
createElement(org.w3c.dom.Document doc,
java.lang.String tag,
java.lang.String nsURI,
java.lang.String prefix)
Creates an element in the specified namespace, with the specified tag
and namespace prefix.
|
static java.lang.String |
getAttributeValue(org.w3c.dom.Element elem,
java.lang.String name)
Returns the attribute value for the attribute with the specified name.
|
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Node node)
Returns the first child element of the specified node, or null if there
is no such element.
|
static org.w3c.dom.Element |
getLastChildElement(org.w3c.dom.Node node)
Returns the last child element of the specified node, or null if there
is no such element.
|
static org.w3c.dom.Element |
getNextSiblingElement(org.w3c.dom.Node node)
Returns the next sibling element of the specified node, or null if there
is no such element.
|
static java.lang.String |
getNSPrefix(XMLCryptoContext context,
java.lang.String nsURI)
Returns the prefix associated with the specified namespace URI
|
static org.w3c.dom.Document |
getOwnerDocument(org.w3c.dom.Node node)
Returns the owner document of the specified node.
|
static java.lang.String |
getSignaturePrefix(XMLCryptoContext context)
Returns the prefix associated with the XML Signature namespace URI
|
static boolean |
nodesEqual(org.w3c.dom.Node thisNode,
org.w3c.dom.Node otherNode)
Compares 2 nodes for equality.
|
static java.util.Set |
nodeSet(org.w3c.dom.NodeList nl)
Returns a Set of
Node s, backed by the specified
NodeList . |
static boolean |
paramsEqual(java.security.spec.AlgorithmParameterSpec spec1,
java.security.spec.AlgorithmParameterSpec spec2) |
static void |
removeAllChildren(org.w3c.dom.Node node)
Removes all children nodes from the specified node.
|
static void |
setAttribute(org.w3c.dom.Element elem,
java.lang.String name,
java.lang.String value)
Sets an element's attribute (using DOM level 2) with the
specified value and namespace prefix.
|
static void |
setAttributeID(org.w3c.dom.Element elem,
java.lang.String name,
java.lang.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.
|
public static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)
node
- the nodepublic static org.w3c.dom.Element createElement(org.w3c.dom.Document doc, java.lang.String tag, java.lang.String nsURI, java.lang.String prefix)
doc
- the owner documenttag
- the tagnsURI
- the namespace URIprefix
- the namespace prefixpublic static void setAttribute(org.w3c.dom.Element elem, java.lang.String name, java.lang.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(org.w3c.dom.Element elem, java.lang.String name, java.lang.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 org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node node)
node
- the nodejava.lang.NullPointerException
- if node == null
public static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node node)
node
- the nodejava.lang.NullPointerException
- if node == null
public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node node)
node
- the nodejava.lang.NullPointerException
- if node == null
public static java.lang.String getAttributeValue(org.w3c.dom.Element elem, java.lang.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 attributepublic static java.util.Set nodeSet(org.w3c.dom.NodeList nl)
Node
s, backed by the specified
NodeList
.nl
- the NodeListpublic static java.lang.String getNSPrefix(XMLCryptoContext context, java.lang.String nsURI)
context
- contains the namespace mapnsURI
- the namespace URIpublic static java.lang.String getSignaturePrefix(XMLCryptoContext context)
context
- contains the namespace mappublic static void removeAllChildren(org.w3c.dom.Node node)
node
- the parent node whose children are to be removedpublic static boolean nodesEqual(org.w3c.dom.Node thisNode, org.w3c.dom.Node otherNode)
public static void appendChild(org.w3c.dom.Node parent, org.w3c.dom.Node child)
public static boolean paramsEqual(java.security.spec.AlgorithmParameterSpec spec1, java.security.spec.AlgorithmParameterSpec spec2)
Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.