public class XmlUtil
extends java.lang.Object
| Constructor and Description | 
|---|
| XmlUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static java.lang.String | escapeControlCharacters(java.lang.String orig)Escape control characters (below 0x20) with their XML entities, e.g. | 
| static java.lang.String | escapeXml(java.lang.String orig)Escape the following characters  " ' & < >with their XML entities, e.g. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            boolean namespaceAware,
            boolean validating,
            java.io.File schema)Factory method to create a SAXParser configured to validate according to a particular schema language and
 a File containing the schema to validate against. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            boolean namespaceAware,
            boolean validating,
            javax.xml.transform.Source... schemas)Factory method to create a SAXParser configured to validate according to a particular schema language and
 optionally providing the schema sources to validate with. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            boolean namespaceAware,
            boolean validating,
            java.net.URL schema)Factory method to create a SAXParser configured to validate according to a particular schema language and
 an URL pointing to the schema to validate against. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            java.io.File schema)Factory method to create a SAXParser configured to validate according to a particular schema language and
 a File containing the schema to validate against. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            javax.xml.transform.Source... schemas)Factory method to create a SAXParser configured to validate according to a particular schema language and
 optionally providing the schema sources to validate with. | 
| static javax.xml.parsers.SAXParser | newSAXParser(java.lang.String schemaLanguage,
            java.net.URL schema)Factory method to create a SAXParser configured to validate according to a particular schema language and
 an URL pointing to the schema to validate against. | 
| static java.lang.String | serialize(org.w3c.dom.Element element)Return a pretty String version of the Element. | 
| static void | serialize(org.w3c.dom.Element element,
         java.io.OutputStream os)Write a pretty version of the Element to the OutputStream. | 
| static void | serialize(org.w3c.dom.Element element,
         java.io.Writer w)Write a pretty version of the Element to the Writer. | 
| static java.lang.String | serialize(GPathResult node)Return a pretty version of the GPathResult. | 
| static void | serialize(GPathResult node,
         java.io.OutputStream os)Write a pretty version of the GPathResult to the OutputStream. | 
| static void | serialize(GPathResult node,
         java.io.Writer w)Write a pretty version of the GPathResult to the Writer. | 
| static java.lang.String | serialize(Node node)Return a pretty String version of the Node. | 
| static void | serialize(Node node,
         java.io.OutputStream os)Write a pretty version of the Node to the OutputStream. | 
| static void | serialize(Node node,
         java.io.Writer w)Write a pretty version of the Node to the Writer. | 
| static java.lang.String | serialize(java.lang.String xmlString)Return a pretty version of the XML content contained in the given String. | 
| static void | serialize(java.lang.String xmlString,
         java.io.OutputStream os)Write a pretty version of the given XML string to the OutputStream. | 
| static void | serialize(java.lang.String xmlString,
         java.io.Writer w)Write a pretty version of the given XML string to the Writer. | 
| static java.lang.String | serialize(Writable writable)Return a pretty String version of the XML content produced by the Writable. | 
| static void | serialize(Writable writable,
         java.io.OutputStream os)Write a pretty version of the XML content produced by the Writable to the OutputStream. | 
| static void | serialize(Writable writable,
         java.io.Writer w)Write a pretty version of the XML content produced by the Writable to the Writer. | 
public static java.lang.String serialize(org.w3c.dom.Element element)
element - the Element to serializepublic static void serialize(org.w3c.dom.Element element,
                             java.io.OutputStream os)
element - the Element to serializeos - the OutputStream to write topublic static void serialize(org.w3c.dom.Element element,
                             java.io.Writer w)
element - the Element to serializew - the Writer to write topublic static java.lang.String serialize(Node node)
node - the Node to serializepublic static void serialize(Node node, java.io.OutputStream os)
node - the Node to serializeos - the OutputStream to write topublic static void serialize(Node node, java.io.Writer w)
node - the Node to serializew - the Writer to write topublic static java.lang.String serialize(GPathResult node)
node - a GPathResult to serialize to a Stringpublic static void serialize(GPathResult node, java.io.OutputStream os)
node - a GPathResult to serializeos - the OutputStream to write topublic static void serialize(GPathResult node, java.io.Writer w)
node - a GPathResult to serializew - the Writer to write topublic static java.lang.String serialize(Writable writable)
writable - the Writable to serializepublic static void serialize(Writable writable, java.io.OutputStream os)
writable - the Writable to serializeos - the OutputStream to write topublic static void serialize(Writable writable, java.io.Writer w)
writable - the Writable to serializew - the Writer to write topublic static java.lang.String serialize(java.lang.String xmlString)
xmlString - the String to serializepublic static void serialize(java.lang.String xmlString,
                             java.io.OutputStream os)
xmlString - the String to serializeos - the OutputStream to write topublic static void serialize(java.lang.String xmlString,
                             java.io.Writer w)
xmlString - the String to serializew - the Writer to write topublic static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       javax.xml.transform.Source... schemas)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)schemas - the schemas to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionnewSAXParser(String, boolean, boolean, Source...)public static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       boolean namespaceAware,
                                                       boolean validating,
                                                       javax.xml.transform.Source... schemas)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)namespaceAware - will the parser be namespace awarevalidating - will the parser also validate against DTDsschemas - the schemas to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       java.io.File schema)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)schema - a file containing the schema to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionnewSAXParser(String, boolean, boolean, File)public static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       boolean namespaceAware,
                                                       boolean validating,
                                                       java.io.File schema)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)namespaceAware - will the parser be namespace awarevalidating - will the parser also validate against DTDsschema - a file containing the schema to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       java.net.URL schema)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)schema - a URL pointing to the schema to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionnewSAXParser(String, boolean, boolean, URL)public static javax.xml.parsers.SAXParser newSAXParser(java.lang.String schemaLanguage,
                                                       boolean namespaceAware,
                                                       boolean validating,
                                                       java.net.URL schema)
                                                throws org.xml.sax.SAXException,
                                                       javax.xml.parsers.ParserConfigurationException
schemaLanguage - the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)namespaceAware - will the parser be namespace awarevalidating - will the parser also validate against DTDsschema - a URL pointing to the schema to validate againstorg.xml.sax.SAXExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static java.lang.String escapeXml(java.lang.String orig)
" ' & < > with their XML entities, e.g.
 "bread" & "butter" becomes "bread" & "butter".
 Notes:orig - the original StringescapeControlCharacters(String)public static java.lang.String escapeControlCharacters(java.lang.String orig)
Ctrl-M or \r) becomes 
 Notes:orig - the original StringescapeXml(String)