Class XmlUtil

java.lang.Object
org.opencastproject.util.XmlUtil

public final class XmlUtil extends Object
XML utility functions.
  • Method Details

    • parseNs

      public static Either<Exception,Document> parseNs(InputSource src)
      Namespace aware parsing of src.
    • parseNs

      public static Either<Exception,Document> parseNs(String xml)
      Namespace aware parsing of xml.
    • toXml

      public static void toXml(Document doc, OutputStream out) throws IOException
      Writes an xml representation to a stream.
      Parameters:
      doc - the document
      out - the output stream
      Throws:
      IOException - if there is an error transforming the dom to a stream
    • serializeDocument

      public static InputStream serializeDocument(Document document) throws IOException
      Writes an xml representation to an input stream and return it.
      Parameters:
      document - the document
      Returns:
      the input stream containing the serialized xml representation
      Throws:
      IOException - if there is an error transforming the dom to a stream
    • toXmlString

      public static String toXmlString(Document document) throws IOException
      Serializes the document to a XML string
      Parameters:
      document - the document
      Returns:
      the serialized XML string
      Throws:
      IOException - if there is an error transforming the dom to a stream
    • fromXmlString

      public static InputSource fromXmlString(String xml)
      Create an InputSource from an XML string.
    • newDocument

      public static Document newDocument()
      Creates an xml document root and returns it.
      Returns:
      the document