public class XML
extends java.lang.Object
Constructor and Description |
---|
XML() |
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Document |
getDocument(java.io.File file)
Parse an XML file to DOM
|
static org.w3c.dom.Document |
getDocument(java.io.InputStream stream)
Parse an XML coming from an input stream to DOM
|
static org.w3c.dom.Document |
getDocument(java.lang.String xml)
Parse an XML string content to DOM
|
static javax.xml.parsers.DocumentBuilder |
newDocumentBuilder() |
static javax.xml.parsers.DocumentBuilderFactory |
newDocumentBuilderFactory() |
static java.lang.String |
serialize(org.w3c.dom.Document document)
Serialize to XML String
|
static org.w3c.dom.Document |
sign(org.w3c.dom.Document document,
java.security.interfaces.RSAPublicKey publicKey,
java.security.interfaces.RSAPrivateKey privateKey)
Sign the XML document using xmldsig.
|
static boolean |
validSignature(org.w3c.dom.Document document,
java.security.Key publicKey)
Check the xmldsig signature of the XML document.
|
public static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory()
public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
public static java.lang.String serialize(org.w3c.dom.Document document)
document
- The DOM documentpublic static org.w3c.dom.Document getDocument(java.io.File file)
file
- The XML filepublic static org.w3c.dom.Document getDocument(java.lang.String xml)
xml
- The XML stringpublic static org.w3c.dom.Document getDocument(java.io.InputStream stream)
stream
- The XML streampublic static boolean validSignature(org.w3c.dom.Document document, java.security.Key publicKey)
document
- the document to testpublicKey
- the public key corresponding to the key pair the document was signed withpublic static org.w3c.dom.Document sign(org.w3c.dom.Document document, java.security.interfaces.RSAPublicKey publicKey, java.security.interfaces.RSAPrivateKey privateKey)
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.Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly