Package com.sun.xml.wss.impl
Class XMLUtil
- java.lang.Object
-
- com.sun.xml.wss.impl.XMLUtil
-
public class XMLUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static LoggerloggerThis 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 javax.xml.soap.SOAPFactorysoapFactory
-
Constructor Summary
Constructors Constructor Description XMLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.xml.soap.SOAPElementconvertToSoapElement(Document doc, Element elem)convertToSoapElementstatic StringconvertToXpath(String qname)static ElementcreateElement(Document doc, String tag, String nsURI, String prefix)static byte[]getDecodedBase64EncodedData(String encodedData)static org.apache.xml.security.keys.content.keyvalues.DSAKeyValuegetDSAKeyValue(Document doc, X509Certificate cert)static ListgetElementsByTagNameNS1(Element element, String nsName, String tagName)This method searches children of Element element for element with tagName and namespaceURI nsName.static ElementgetFirstChildElement(Node node)static StringgetFullTextFromChildren(Element element)static DocumentgetOwnerDocument(Node node)static org.apache.xml.security.keys.content.keyvalues.RSAKeyValuegetRSAKeyValue(Document doc, X509Certificate cert)static org.apache.xml.security.keys.content.X509DatagetX509Data(Document doc, X509Certificate cert)static booleanhasElementChild(Node node)Checks if a node has a child of ELEMENT type.static booleaninEncryptionNS(javax.xml.soap.SOAPElement element)static booleaninSamlNSv1_0(javax.xml.soap.SOAPElement element)static booleaninSamlNSv1_1(javax.xml.soap.SOAPElement element)static booleaninSamlNSv2_0(javax.xml.soap.SOAPElement element)static booleaninSignatureNS(javax.xml.soap.SOAPElement element)static booleaninWSS11_NS(javax.xml.soap.SOAPElement element)static booleaninWsscNS(javax.xml.soap.SOAPElement element)static booleaninWsse11NS(javax.xml.soap.SOAPElement element)static booleaninWsseNS(javax.xml.soap.SOAPElement element)static booleaninWsuNS(javax.xml.soap.SOAPElement element)static DocumentnewDocument()Obtains a new instance of a DOM Document objectstatic ElementprependChildElement(Element parent, Element child, boolean addWhitespace, Document doc)static ElementprependChildElement(Element parent, Element child, Document doc)static Stringprint(Node node)Print a Node tree recursively.static StringresolveXPath(Node element)static voidsetIdAttr(Element element, String Id)static voidsetWsuIdAttr(Element element, String wsuId)static DocumenttoDOMDocument(InputStream is)Converts the XML document from an input stream to DOM Document format.static DocumenttoDOMDocument(String xmlString)Converts the XML document from a String format to DOM Document format.
-
-
-
Field Detail
-
logger
protected static final 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 javax.xml.soap.SOAPFactory soapFactory
-
-
Method Detail
-
convertToSoapElement
public static javax.xml.soap.SOAPElement convertToSoapElement(Document doc, Element elem) throws DOMException, ClassCastException
convertToSoapElement- Parameters:
doc- the Owner Soap Document of the SOAPElement to be returnedelem- the DOM Element to be converted to SOAPElement- Returns:
- a SOAPElement whose parent node is null
- Throws:
DOMExceptionClassCastException
-
getElementsByTagNameNS1
public static List getElementsByTagNameNS1(Element element, String nsName, 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 elementnsName- NamespaceURItagName- A String representing the name of the tag to be searched for.- Returns:
- A List of elements that meet the criterial.
-
inEncryptionNS
public static boolean inEncryptionNS(javax.xml.soap.SOAPElement element)
-
inSamlNSv1_0
public static boolean inSamlNSv1_0(javax.xml.soap.SOAPElement element)
-
inSamlNSv2_0
public static boolean inSamlNSv2_0(javax.xml.soap.SOAPElement element)
-
inSamlNSv1_1
public static boolean inSamlNSv1_1(javax.xml.soap.SOAPElement element)
-
inSignatureNS
public static boolean inSignatureNS(javax.xml.soap.SOAPElement element)
-
inWsseNS
public static boolean inWsseNS(javax.xml.soap.SOAPElement element)
-
inWsscNS
public static boolean inWsscNS(javax.xml.soap.SOAPElement element)
-
inWsse11NS
public static boolean inWsse11NS(javax.xml.soap.SOAPElement element)
-
inWSS11_NS
public static boolean inWSS11_NS(javax.xml.soap.SOAPElement element)
-
inWsuNS
public static boolean inWsuNS(javax.xml.soap.SOAPElement element)
-
prependChildElement
public static Element prependChildElement(Element parent, Element child, boolean addWhitespace, Document doc)
-
prependChildElement
public static Element prependChildElement(Element parent, Element child, Document doc)
-
print
public static String print(Node node)
Print a Node tree recursively.- Parameters:
node- A DOM tree Node- Returns:
- An xml String representation of the DOM tree.
-
toDOMDocument
public static Document toDOMDocument(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 Document toDOMDocument(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 Document newDocument() throws ParserConfigurationException
Obtains a new instance of a DOM Document object- Returns:
- a new instance of a DOM Document object
- Throws:
ParserConfigurationException- if an error occurs while constructing a new document
-
hasElementChild
public static boolean hasElementChild(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 org.apache.xml.security.keys.content.keyvalues.DSAKeyValue getDSAKeyValue(Document doc, X509Certificate cert) throws com.sun.xml.wss.XWSSecurityException
- Throws:
com.sun.xml.wss.XWSSecurityException
-
getRSAKeyValue
public static org.apache.xml.security.keys.content.keyvalues.RSAKeyValue getRSAKeyValue(Document doc, X509Certificate cert) throws com.sun.xml.wss.XWSSecurityException
- Throws:
com.sun.xml.wss.XWSSecurityException
-
getX509Data
public static org.apache.xml.security.keys.content.X509Data getX509Data(Document doc, X509Certificate cert) throws com.sun.xml.wss.XWSSecurityException
- Throws:
com.sun.xml.wss.XWSSecurityException
-
getDecodedBase64EncodedData
public static byte[] getDecodedBase64EncodedData(String encodedData) throws com.sun.xml.wss.XWSSecurityException
- Throws:
com.sun.xml.wss.XWSSecurityException
-
-