public final class XmlHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static javax.xml.parsers.DocumentBuilderFactory |
BUILDING_FACTORY
The BUILDING factory.
|
static javax.xml.transform.TransformerFactory |
TRANSFORMER_FACTORY
The Constant TRANSFORMER_FACTORY.
|
static java.lang.String |
XML_HEADER_UTF8
The Constant XML_HEADER_UTF8.
|
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Element |
createElement(org.w3c.dom.Node parent,
java.lang.String nodeName)
Creates the element.
|
static org.w3c.dom.Text |
createText(org.w3c.dom.Node parent,
java.lang.String text)
Creates the text.
|
static org.w3c.dom.Document |
newDocument()
New document.
|
static org.w3c.dom.Document |
newDocument(java.lang.String rootName)
New document.
|
static org.w3c.dom.Document |
parse(byte[] input)
Parses the.
|
static org.w3c.dom.Document |
parse(java.lang.String input)
Parses the.
|
static byte[] |
toByteArray(org.w3c.dom.Document document)
To byte array.
|
static java.lang.String |
toString(org.w3c.dom.Document document)
To string.
|
static java.lang.String |
toString(org.w3c.dom.Document document,
boolean xmlDeclaration)
To string.
|
static void |
transform(org.w3c.dom.Document document,
javax.xml.transform.stream.StreamResult streamResult,
boolean xmlDeclaration)
Transform.
|
public static final javax.xml.parsers.DocumentBuilderFactory BUILDING_FACTORY
public static final javax.xml.transform.TransformerFactory TRANSFORMER_FACTORY
public static final java.lang.String XML_HEADER_UTF8
public static java.lang.String toString(org.w3c.dom.Document document)
document - the documentpublic static java.lang.String toString(org.w3c.dom.Document document,
boolean xmlDeclaration)
document - the documentxmlDeclaration - the xml declarationpublic static byte[] toByteArray(org.w3c.dom.Document document)
document - the documentpublic static void transform(org.w3c.dom.Document document,
javax.xml.transform.stream.StreamResult streamResult,
boolean xmlDeclaration)
document - the documentstreamResult - the stream resultxmlDeclaration - the xml declarationpublic static org.w3c.dom.Document parse(java.lang.String input)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
input - the inputjava.io.IOException - Signals that an I/O exception has occurred.javax.xml.parsers.ParserConfigurationException - the parser configuration exceptionorg.xml.sax.SAXException - the SAX exceptionpublic static org.w3c.dom.Document parse(byte[] input)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
input - the inputjava.io.IOException - Signals that an I/O exception has occurred.javax.xml.parsers.ParserConfigurationException - the parser configuration exceptionorg.xml.sax.SAXException - the SAX exceptionpublic static org.w3c.dom.Document newDocument()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException - the parser configuration exceptionpublic static org.w3c.dom.Document newDocument(java.lang.String rootName)
throws javax.xml.parsers.ParserConfigurationException
rootName - the root namejavax.xml.parsers.ParserConfigurationException - the parser configuration exceptionpublic static org.w3c.dom.Element createElement(org.w3c.dom.Node parent,
java.lang.String nodeName)
parent - the parentnodeName - the node namepublic static org.w3c.dom.Text createText(org.w3c.dom.Node parent,
java.lang.String text)
parent - the parenttext - the text