Package play.libs

Class XML


  • public final class XML
    extends Object
    XML utilities.
    • Constructor Detail

      • XML

        public XML()
    • Method Detail

      • fromString

        public static Document fromString​(String xml)
        Parses an XML string as DOM.
        Parameters:
        xml - the input XML string
        Returns:
        the parsed XML DOM root.
      • fromInputStream

        public static Document fromInputStream​(InputStream in,
                                               String encoding)
        Parses an InputStream as DOM.
        Parameters:
        in - the inputstream to parse.
        encoding - the encoding of the input stream, if not null.
        Returns:
        the parsed XML DOM.
      • fromInputSource

        public static Document fromInputSource​(InputSource source)
        Parses the input source as DOM.
        Parameters:
        source - The source to parse.
        Returns:
        The Document.
      • toBytes

        public static ByteString toBytes​(Document document)
        Converts the document to bytes.
        Parameters:
        document - The document to convert.
        Returns:
        The ByteString representation of the document.