Package org.opencastproject.util
Class XmlUtil
java.lang.Object
org.opencastproject.util.XmlUtil
XML utility functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic InputSourcefromXmlString(String xml) Create anInputSourcefrom an XML string.static DocumentCreates an xml document root and returns it.Namespace aware parsing ofxml.parseNs(InputSource src) Namespace aware parsing ofsrc.static InputStreamserializeDocument(Document document) Writes an xml representation to an input stream and return it.static voidtoXml(Document doc, OutputStream out) Writes an xml representation to a stream.static StringtoXmlString(Document document) Serializes the document to a XML string
-
Method Details
-
parseNs
Namespace aware parsing ofsrc. -
parseNs
Namespace aware parsing ofxml. -
toXml
Writes an xml representation to a stream.- Parameters:
doc- the documentout- the output stream- Throws:
IOException- if there is an error transforming the dom to a stream
-
serializeDocument
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
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
Create anInputSourcefrom an XML string. -
newDocument
Creates an xml document root and returns it.- Returns:
- the document
-