Package play.libs
Class XML
java.lang.Object
play.libs.XML
XML utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentgetDocument(File file) Parse an XML file to DOMstatic DocumentgetDocument(InputStream stream) Parse an XML coming from an input stream to DOMstatic DocumentgetDocument(String xml) Parse an XML string content to DOMstatic DocumentBuilderstatic DocumentBuilderFactorystatic StringSerialize to XML Stringstatic Documentsign(Document document, RSAPublicKey publicKey, RSAPrivateKey privateKey) Sign the XML document using xmldsig.static booleanvalidSignature(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.
-