play.libs

## Class XML

- java.lang.Object
- - play.libs.XML

-     public class XML
      extends java.lang.Object

  XML utils

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XML()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    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.File file, boolean namespaceAware)` 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.io.InputStream stream, boolean namespaceAware)` 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 org.w3c.dom.Document` | `getDocument(java.lang.String xml, boolean namespaceAware)` Parse an XML string content to DOM
    `static javax.xml.parsers.DocumentBuilder` | `newDocumentBuilder()`
    `static javax.xml.parsers.DocumentBuilder` | `newDocumentBuilder(boolean namespaceAware)`
    `static javax.xml.parsers.DocumentBuilderFactory` | `newDocumentBuilderFactory()`
    `static javax.xml.parsers.DocumentBuilderFactory` | `newDocumentBuilderFactory(boolean namespaceAware)`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XML

          public XML()

  - ### Method Detail

    - #### newDocumentBuilderFactory

          public static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory()

    - #### newDocumentBuilderFactory

          public static javax.xml.parsers.DocumentBuilderFactory newDocumentBuilderFactory(boolean namespaceAware)

    - #### newDocumentBuilder

          public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()

    - #### newDocumentBuilder

          public static javax.xml.parsers.DocumentBuilder newDocumentBuilder(boolean namespaceAware)

    - #### serialize

          public static java.lang.String serialize(org.w3c.dom.Document document)

      Serialize to XML String
      Parameters:
        `document` - The DOM document
      Returns:
        The XML String

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.io.File file)

      Parse an XML file to DOM
      Parameters:
        `file` - The XML file
      Returns:
        null if an error occurs during parsing.

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.io.File file,
                                                         boolean namespaceAware)

      Parse an XML file to DOM
      Parameters:
        `file` - The XML file
        `namespaceAware` - whether to output XML namespace information in the returned document
      Returns:
        null if an error occurs during parsing.

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.lang.String xml)

      Parse an XML string content to DOM
      Parameters:
        `xml` - The XML string
      Returns:
        null if an error occurs during parsing.

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.lang.String xml,
                                                         boolean namespaceAware)

      Parse an XML string content to DOM
      Parameters:
        `xml` - The XML string
        `namespaceAware` - whether to output XML namespace information in the returned document
      Returns:
        null if an error occurs during parsing.

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.io.InputStream stream)

      Parse an XML coming from an input stream to DOM
      Parameters:
        `stream` - The XML stream
      Returns:
        null if an error occurs during parsing.

    - #### getDocument

          public static org.w3c.dom.Document getDocument(java.io.InputStream stream,
                                                         boolean namespaceAware)

      Parse an XML coming from an input stream to DOM
      Parameters:
        `stream` - The XML stream
        `namespaceAware` - whether to output XML namespace information in the returned document
      Returns:
        null if an error occurs during parsing.

    - #### validSignature

          public static boolean validSignature(org.w3c.dom.Document document,
                                               java.security.Key publicKey)

      Check the xmldsig signature of the XML document.
      Parameters:
        `document` - the document to test
        `publicKey` - the public key corresponding to the key pair the document was signed with
      Returns:
        true if a correct signature is present, false otherwise

    - #### sign

          public 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.
      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.

Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly