|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xml.security.utils.XMLUtils
DOM and XML accessibility and comfort functions.
Field Summary | |
static java.lang.String |
randomNSprefix
Prefix for random namespaces. |
Method Summary | |
static void |
addReturnToElement(org.w3c.dom.Element e)
Method addReturnToElement |
static void |
addReturnToElement(ElementProxy elementProxy)
Method addReturnToElement |
static void |
addReturnToNode(org.w3c.dom.Node n)
Method addReturnToNode |
static void |
circumventBug2650(org.w3c.dom.Document doc)
This method spreads all namespace attributes in a DOM document to their children. |
protected static java.lang.Class |
classForName(java.lang.String className)
Worker method to load a class. |
static java.util.Set |
convertNodelistToSet(org.w3c.dom.NodeList xpathNodeSet)
Method convertNodelistToSet |
static org.w3c.dom.NodeList |
convertSetToNodelist(java.util.Set set)
Method convertSetToNodelist |
static org.w3c.dom.Attr |
createAttr(org.w3c.dom.Document doc,
java.lang.String QName,
java.lang.String Value,
java.lang.String NamespaceURI)
Creates Attributes Attr in the given namespace
(if possible). |
static org.w3c.dom.Element |
createDSctx(org.w3c.dom.Document doc,
java.lang.String prefix)
Method createDSctx |
static org.w3c.dom.Element |
createDSctx(org.w3c.dom.Document doc,
java.lang.String prefix,
java.lang.String namespace)
Method createDSctx |
static org.w3c.dom.Element |
createElementFromBigint(org.w3c.dom.Document doc,
java.lang.String elementName,
java.math.BigInteger bigInteger)
Creates an Element from a BigInteger. |
static org.w3c.dom.Element |
createElementInEncryptionSpace(org.w3c.dom.Document doc,
java.lang.String elementName)
Creates an Element in the XML Encryption specification namespace. |
static org.w3c.dom.Element |
createElementInSignatureSpace(org.w3c.dom.Document doc,
java.lang.String elementName)
Creates an Element in the XML Signature specification namespace. |
static boolean |
elementIsInEncryptionSpace(org.w3c.dom.Element element,
java.lang.String localName)
Returns true if the element is in XML Encryption namespace and the local name equals the supplied one. |
static boolean |
elementIsInSignatureSpace(org.w3c.dom.Element element,
java.lang.String localName)
Returns true if the element is in XML Signature namespace and the local name equals the supplied one. |
static org.w3c.dom.NodeList |
elementToNodeList(org.w3c.dom.Node node)
Converts a single Node into a NodeList which contains only that Node |
protected static java.lang.ClassLoader |
findClassLoader()
Worker method to figure out which ClassLoader to use. |
static java.util.Vector |
getAncestorElements(org.w3c.dom.Node ctxNode)
Returns all ancestor elements of a given node up to the document element |
static java.util.Vector |
getAncestorElements(org.w3c.dom.Node ctxNode,
org.w3c.dom.Node rootElement)
Returns all ancestor elements of a given node up to the given root element |
static java.math.BigInteger |
getBigintFromElement(org.w3c.dom.Element element)
Fetches a base64-encoded BigInteger from an Element. |
static byte[] |
getBytesFromElement(org.w3c.dom.Element element)
Fetches base64-encoded byte[] data from an Element. |
static org.w3c.dom.Element |
getDirectChild(org.w3c.dom.Element parentElement,
java.lang.String childLocalName,
java.lang.String childNamespaceURI)
Method getDirectChild |
static org.w3c.dom.NodeList |
getDirectChildrenElements(org.w3c.dom.Element parentElement)
Method getDirectChildrenElements |
static java.lang.String |
getFullTextChildrenFromElement(org.w3c.dom.Element element)
Method getFullTextChildrenFromElement |
static java.lang.String |
getNodeTypeString(org.w3c.dom.Node n)
Method getNodeTypeString |
static java.lang.String |
getNodeTypeString(short nodeType)
Transforms org.w3c.dom.Node.XXX_NODE NodeType values into
Strings. |
static org.w3c.dom.Document |
getOwnerDocument(org.w3c.dom.Node node)
This method returns the owner document of a particular node. |
static java.lang.String |
getRandomNamespacePrefix()
This method creates a random String like http://www.xmlsecurity.org/NS#randomval8dcc/C2qwxFukXjJhS7W1xvHHq4Z
that will be used for registering the here() function in a
specific namespace. |
static java.lang.String |
getXalanVersion()
Method getXalanVersion |
static java.lang.String |
getXercesVersion()
Method getXercesVersion |
static java.lang.String |
getXPath(org.w3c.dom.Node n)
Simple tool to return the position of a particular node in an XPath like String. |
static void |
guaranteeThatElementInEncryptionSpace(org.w3c.dom.Element element,
java.lang.String localName)
Verifies that the given Element is in the XML Encryption namespace EncryptionConstants.EncryptionSpecNS and that the
local name of the Element matches the supplied on. |
static void |
guaranteeThatElementInSignatureSpace(org.w3c.dom.Element element,
java.lang.String localName)
Verifies that the given Element is in the XML Signature namespace Constants.SignatureSpecNS and that the
local name of the Element matches the supplied on. |
static void |
outputDOM(org.w3c.dom.Node contextNode,
java.io.OutputStream os)
Outputs a DOM tree to an OutputStream . |
static void |
outputDOM(org.w3c.dom.Node contextNode,
java.io.OutputStream os,
boolean addPreamble)
Outputs a DOM tree to an OutputStream . |
static void |
outputDOM(org.w3c.dom.Node contextNode,
java.lang.String filename)
Outputs a DOM tree to a file. |
static void |
outputDOMc14nWithComments(org.w3c.dom.Node contextNode,
java.io.OutputStream os)
Serializes the contextNode into the OutputStream, but
supresses all Exceptions.
|
static void |
setAttr(org.w3c.dom.Element elem,
java.lang.String QName,
java.lang.String Value)
Sets the Attribute QName with Value in Element elem. |
static void |
spitOutVersions(org.apache.log4j.Category cat)
Method spitOutVersions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String randomNSprefix
getRandomNamespacePrefix()
,
Constant Field ValuesMethod Detail |
public static java.lang.String getXalanVersion()
public static java.lang.String getXercesVersion()
protected static java.lang.Class classForName(java.lang.String className) throws java.lang.ClassNotFoundException
className
- name of class to load from
an appropriate classLoader
java.lang.ClassNotFoundException
protected static java.lang.ClassLoader findClassLoader() throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static void spitOutVersions(org.apache.log4j.Category cat)
cat
- public static java.lang.String getNodeTypeString(short nodeType)
org.w3c.dom.Node.XXX_NODE
NodeType values into
Strings.
nodeType
- as taken from the Node.getNodeType()
function
Node.getNodeType()
public static java.lang.String getNodeTypeString(org.w3c.dom.Node n)
n
- public static java.util.Vector getAncestorElements(org.w3c.dom.Node ctxNode)
ctxNode
- public static java.util.Vector getAncestorElements(org.w3c.dom.Node ctxNode, org.w3c.dom.Node rootElement)
ctxNode
- rootElement
- public static org.w3c.dom.NodeList getDirectChildrenElements(org.w3c.dom.Element parentElement)
parentElement
- public static org.w3c.dom.Element getDirectChild(org.w3c.dom.Element parentElement, java.lang.String childLocalName, java.lang.String childNamespaceURI)
parentElement
- childLocalName
- childNamespaceURI
- public static void outputDOM(org.w3c.dom.Node contextNode, java.lang.String filename) throws java.io.FileNotFoundException
contextNode
- root node of the DOM treefilename
- the file name
java.io.FileNotFoundException
public static void outputDOM(org.w3c.dom.Node contextNode, java.io.OutputStream os)
OutputStream
.
contextNode
- root node of the DOM treeos
- the OutputStream
public static void outputDOM(org.w3c.dom.Node contextNode, java.io.OutputStream os, boolean addPreamble)
OutputStream
. If an Exception is
thrown during execution, it's StackTrace is output to System.out, but the
Exception is not re-thrown.
contextNode
- root node of the DOM treeos
- the OutputStream
addPreamble
- public static void outputDOMc14nWithComments(org.w3c.dom.Node contextNode, java.io.OutputStream os)
contextNode
into the OutputStream, but
supresses all Exceptions.
try{}
statement, but handle the Exceptions appropriately.
contextNode
- os
- public static org.w3c.dom.NodeList elementToNodeList(org.w3c.dom.Node node)
Node
into a NodeList
which contains only that Node
node
- the Node
public static org.w3c.dom.Attr createAttr(org.w3c.dom.Document doc, java.lang.String QName, java.lang.String Value, java.lang.String NamespaceURI)
Attr
in the given namespace
(if possible). If the namespace is empty, only the QName is used.
doc
- the generator (factory) DocumentQName
- the QName of the AttrValue
- the String value of the AttrNamespaceURI
- the namespace for the Attr
public static void setAttr(org.w3c.dom.Element elem, java.lang.String QName, java.lang.String Value)
elem
- the Element which has to contain the AttributeQName
- the QName of the AttributeValue
- the value of the Attributepublic static org.w3c.dom.Element createElementFromBigint(org.w3c.dom.Document doc, java.lang.String elementName, java.math.BigInteger bigInteger) throws XMLSignatureException
doc
- the factory DocumentelementName
- the name of the ElementbigInteger
- the BigInteger wo be inserted
XMLSignatureException
- if bigInteger is not positivepublic static java.lang.String getFullTextChildrenFromElement(org.w3c.dom.Element element)
element
- public static java.math.BigInteger getBigintFromElement(org.w3c.dom.Element element) throws XMLSignatureException
element
- the Element
XMLSignatureException
- if Element has not exactly one Text childpublic static byte[] getBytesFromElement(org.w3c.dom.Element element) throws XMLSignatureException
element
-
XMLSignatureException
- if Element has not exactly one Text childpublic static org.w3c.dom.Element createElementInSignatureSpace(org.w3c.dom.Document doc, java.lang.String elementName)
doc
- the factory DocumentelementName
- the local name of the Element
public static org.w3c.dom.Element createElementInEncryptionSpace(org.w3c.dom.Document doc, java.lang.String elementName)
doc
- the factory DocumentelementName
- the local name of the Element
public static boolean elementIsInSignatureSpace(org.w3c.dom.Element element, java.lang.String localName)
element
- localName
-
public static boolean elementIsInEncryptionSpace(org.w3c.dom.Element element, java.lang.String localName)
element
- localName
-
public static void guaranteeThatElementInSignatureSpace(org.w3c.dom.Element element, java.lang.String localName) throws XMLSignatureException
Constants.SignatureSpecNS
and that the
local name of the Element matches the supplied on.
element
- Element to be checkedlocalName
-
XMLSignatureException
- if element is not in Signature namespace or if the local name does not matchConstants.SignatureSpecNS
public static void guaranteeThatElementInEncryptionSpace(org.w3c.dom.Element element, java.lang.String localName) throws XMLSecurityException
EncryptionConstants.EncryptionSpecNS
and that the
local name of the Element matches the supplied on.
element
- Element to be checkedlocalName
-
XMLSecurityException
- if element is not in Encryption namespace or if the local name does not matchEncryptionConstants.EncryptionSpecNS
public static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)
Document
. Node.getOwnerDocument()
returns null
if the Node
is a Document
.
node
-
public static java.lang.String getRandomNamespacePrefix()
http://www.xmlsecurity.org/NS#randomval8dcc/C2qwxFukXjJhS7W1xvHHq4Z
that will be used for registering the here()
function in a
specific namespace. The random string is the Base64 encoded version of a
168 bit SecureRandom
value.
public static org.w3c.dom.Element createDSctx(org.w3c.dom.Document doc, java.lang.String prefix, java.lang.String namespace)
doc
- prefix
- namespace
- public static org.w3c.dom.Element createDSctx(org.w3c.dom.Document doc, java.lang.String prefix)
doc
- prefix
- public static void addReturnToElement(ElementProxy elementProxy)
elementProxy
- public static void addReturnToElement(org.w3c.dom.Element e)
e
- public static void addReturnToNode(org.w3c.dom.Node n)
n
- public static java.util.Set convertNodelistToSet(org.w3c.dom.NodeList xpathNodeSet)
xpathNodeSet
- public static org.w3c.dom.NodeList convertSetToNodelist(java.util.Set set)
set
- public static void circumventBug2650(org.w3c.dom.Document doc)
doc
- public static java.lang.String getXPath(org.w3c.dom.Node n)
n
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |