com.sun.xml.wss.impl
Class XMLUtil

java.lang.Object
  extended by com.sun.xml.wss.impl.XMLUtil

public class XMLUtil
extends java.lang.Object


Field Summary
protected static java.util.logging.Logger logger
          This is a custom XML handler to load the dtds from the classpath This should be used by all the xml parsing document builders to set the default entity resolvers.
protected static SOAPFactory soapFactory
           
 
Constructor Summary
XMLUtil()
           
 
Method Summary
static SOAPElement convertToSoapElement(org.w3c.dom.Document doc, org.w3c.dom.Element elem)
          convertToSoapElement
static java.lang.String convertToXpath(java.lang.String qname)
          Looks up elements with wsu:Id or Id in xenc or dsig namespace.
static org.w3c.dom.Element createElement(org.w3c.dom.Document doc, java.lang.String tag, java.lang.String nsURI, java.lang.String prefix)
           
static byte[] getDecodedBase64EncodedData(java.lang.String encodedData)
           
static com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue getDSAKeyValue(org.w3c.dom.Document doc, java.security.cert.X509Certificate cert)
           
static java.util.List getElementsByTagNameNS1(org.w3c.dom.Element element, java.lang.String nsName, java.lang.String tagName)
          This method searches children of Element element for element with tagName and namespaceURI nsName.
static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node node)
           
static java.lang.String getFullTextFromChildren(org.w3c.dom.Element element)
           
static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)
           
static com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue getRSAKeyValue(org.w3c.dom.Document doc, java.security.cert.X509Certificate cert)
           
static com.sun.org.apache.xml.internal.security.keys.content.X509Data getX509Data(org.w3c.dom.Document doc, java.security.cert.X509Certificate cert)
           
static boolean hasElementChild(org.w3c.dom.Node node)
          Checks if a node has a child of ELEMENT type.
static boolean inEncryptionNS(SOAPElement element)
           
static boolean inSamlNSv1_0(SOAPElement element)
           
static boolean inSamlNSv1_1(SOAPElement element)
           
static boolean inSamlNSv2_0(SOAPElement element)
           
static boolean inSignatureNS(SOAPElement element)
           
static boolean inWSS11_NS(SOAPElement element)
           
static boolean inWsscNS(SOAPElement element)
           
static boolean inWsse11NS(SOAPElement element)
           
static boolean inWsseNS(SOAPElement element)
           
static boolean inWsuNS(SOAPElement element)
           
static org.w3c.dom.Document newDocument()
          Obtains a new instance of a DOM Document object
static org.w3c.dom.Element prependChildElement(org.w3c.dom.Element parent, org.w3c.dom.Element child, boolean addWhitespace, org.w3c.dom.Document doc)
           
static org.w3c.dom.Element prependChildElement(org.w3c.dom.Element parent, org.w3c.dom.Element child, org.w3c.dom.Document doc)
           
static java.lang.String print(org.w3c.dom.Node node)
          Print a Node tree recursively.
static java.lang.String resolveXPath(org.w3c.dom.Node element)
           
static void setIdAttr(org.w3c.dom.Element element, java.lang.String Id)
           
static void setWsuIdAttr(org.w3c.dom.Element element, java.lang.String wsuId)
           
static org.w3c.dom.Document toDOMDocument(java.io.InputStream is)
          Converts the XML document from an input stream to DOM Document format.
static org.w3c.dom.Document toDOMDocument(java.lang.String xmlString)
          Converts the XML document from a String format to DOM Document format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger
This is a custom XML handler to load the dtds from the classpath This should be used by all the xml parsing document builders to set the default entity resolvers. This will avoid to have the dtds having specified in a fixed directory that will get replaced during installation This will need to specify the dtds as follows jar://com/sun/identity/sm/sms.dtd Bundle all the dtds along with the jar files and


soapFactory

protected static SOAPFactory soapFactory
Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

convertToSoapElement

public static SOAPElement convertToSoapElement(org.w3c.dom.Document doc,
                                               org.w3c.dom.Element elem)
                                        throws org.w3c.dom.DOMException,
                                               java.lang.ClassCastException
convertToSoapElement

Parameters:
doc - the Owner Soap Document of the SOAPElement to be returned
elem - the DOM Element to be converted to SOAPElement
Returns:
a SOAPElement whose parent node is null
Throws:
org.w3c.dom.DOMException
java.lang.ClassCastException

getElementsByTagNameNS1

public static java.util.List getElementsByTagNameNS1(org.w3c.dom.Element element,
                                                     java.lang.String nsName,
                                                     java.lang.String tagName)
This method searches children of Element element for element with tagName and namespaceURI nsName. It searchs one level down only.

Parameters:
element - The root element
nsName - NamespaceURI
tagName - A String representing the name of the tag to be searched for.
Returns:
A List of elements that meet the criterial.

getFullTextFromChildren

public static java.lang.String getFullTextFromChildren(org.w3c.dom.Element element)

inEncryptionNS

public static boolean inEncryptionNS(SOAPElement element)

inSamlNSv1_0

public static boolean inSamlNSv1_0(SOAPElement element)

inSamlNSv2_0

public static boolean inSamlNSv2_0(SOAPElement element)

inSamlNSv1_1

public static boolean inSamlNSv1_1(SOAPElement element)

inSignatureNS

public static boolean inSignatureNS(SOAPElement element)

inWsseNS

public static boolean inWsseNS(SOAPElement element)

inWsscNS

public static boolean inWsscNS(SOAPElement element)

inWsse11NS

public static boolean inWsse11NS(SOAPElement element)

inWSS11_NS

public static boolean inWSS11_NS(SOAPElement element)

inWsuNS

public static boolean inWsuNS(SOAPElement element)

resolveXPath

public static java.lang.String resolveXPath(org.w3c.dom.Node element)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

prependChildElement

public static org.w3c.dom.Element prependChildElement(org.w3c.dom.Element parent,
                                                      org.w3c.dom.Element child,
                                                      boolean addWhitespace,
                                                      org.w3c.dom.Document doc)

prependChildElement

public static org.w3c.dom.Element prependChildElement(org.w3c.dom.Element parent,
                                                      org.w3c.dom.Element child,
                                                      org.w3c.dom.Document doc)

print

public static java.lang.String print(org.w3c.dom.Node node)
Print a Node tree recursively.

Parameters:
node - A DOM tree Node
Returns:
An xml String representation of the DOM tree.

setWsuIdAttr

public static void setWsuIdAttr(org.w3c.dom.Element element,
                                java.lang.String wsuId)

setIdAttr

public static void setIdAttr(org.w3c.dom.Element element,
                             java.lang.String Id)

toDOMDocument

public static org.w3c.dom.Document toDOMDocument(java.io.InputStream is)
Converts the XML document from an input stream to DOM Document format.

Parameters:
is - is the InputStream that contains XML document
Returns:
Document is the DOM object obtained by parsing the input stream. Returns null if there are any parser errores.

toDOMDocument

public static org.w3c.dom.Document toDOMDocument(java.lang.String xmlString)
Converts the XML document from a String format to DOM Document format.

Parameters:
xmlString - is the XML document in a String format
Returns:
Document is the DOM object obtained by converting the String XML Returns null if xmlString is null. Returns null if there are any parser errores.

newDocument

public static org.w3c.dom.Document newDocument()
                                        throws javax.xml.parsers.ParserConfigurationException
Obtains a new instance of a DOM Document object

Returns:
a new instance of a DOM Document object
Throws:
java.lang.Exception - if an error occurs while constructing a new document
javax.xml.parsers.ParserConfigurationException

hasElementChild

public static boolean hasElementChild(org.w3c.dom.Node node)
Checks if a node has a child of ELEMENT type.

Parameters:
node - a node
Returns:
true if the node has a child of ELEMENT type

getDSAKeyValue

public static com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue getDSAKeyValue(org.w3c.dom.Document doc,
                                                                                                         java.security.cert.X509Certificate cert)
                                                                                                  throws XWSSecurityException
Throws:
XWSSecurityException

getRSAKeyValue

public static com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue getRSAKeyValue(org.w3c.dom.Document doc,
                                                                                                         java.security.cert.X509Certificate cert)
                                                                                                  throws XWSSecurityException
Throws:
XWSSecurityException

getX509Data

public static com.sun.org.apache.xml.internal.security.keys.content.X509Data getX509Data(org.w3c.dom.Document doc,
                                                                                         java.security.cert.X509Certificate cert)
                                                                                  throws XWSSecurityException
Throws:
XWSSecurityException

convertToXpath

public static java.lang.String convertToXpath(java.lang.String qname)
Looks up elements with wsu:Id or Id in xenc or dsig namespace.

Parameters:
doc -
id -
Returns:
element
Throws:
javax.xml.transform.TransformerException

getDecodedBase64EncodedData

public static byte[] getDecodedBase64EncodedData(java.lang.String encodedData)
                                          throws XWSSecurityException
Throws:
XWSSecurityException

getOwnerDocument

public static org.w3c.dom.Document getOwnerDocument(org.w3c.dom.Node node)

getFirstChildElement

public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node node)

createElement

public static org.w3c.dom.Element createElement(org.w3c.dom.Document doc,
                                                java.lang.String tag,
                                                java.lang.String nsURI,
                                                java.lang.String prefix)


Copyright © 2005-2011 Oracle Corporation. All Rights Reserved.