Package play.libs
Class XML
java.lang.Object
play.libs.XML
XML utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Document
getDocument
(File file) Parse an XML file to DOMstatic Document
getDocument
(InputStream stream) Parse an XML coming from an input stream to DOMstatic Document
getDocument
(String xml) Parse an XML string content to DOMstatic DocumentBuilder
static DocumentBuilderFactory
static String
Serialize to XML Stringstatic Document
sign
(Document document, RSAPublicKey publicKey, RSAPrivateKey privateKey) Sign the XML document using xmldsig.static boolean
validSignature
(Document document, Key publicKey) Check the xmldsig signature of the XML document.
-
Constructor Details
-
XML
public XML()
-
-
Method Details
-
newDocumentBuilderFactory
-
newDocumentBuilder
-
serialize
Serialize to XML String- Parameters:
document
- The DOM document- Returns:
- The XML String
-
getDocument
Parse an XML file to DOM- Parameters:
file
- The XML file- Returns:
- null if an error occurs during parsing.
-
getDocument
Parse an XML string content to DOM- Parameters:
xml
- The XML string- Returns:
- null if an error occurs during parsing.
-
getDocument
Parse an XML coming from an input stream to DOM- Parameters:
stream
- The XML stream- Returns:
- null if an error occurs during parsing.
-
validSignature
Check the xmldsig signature of the XML document.- Parameters:
document
- the document to testpublicKey
- the public key corresponding to the key pair the document was signed with- Returns:
- true if a correct signature is present, false otherwise
-
sign
Sign the XML document using xmldsig.- Parameters:
document
- the document to sign; it will be modified by the method.publicKey
- the public key from the key pair to sign the document.privateKey
- the private key from the key pair to sign the document.- Returns:
- the signed document for chaining.
-