public class XmlUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Element |
findElement(org.w3c.dom.Element parent,
java.lang.String tagName,
boolean deep)
Search for an element in a node
|
static java.lang.String |
formatDocument(org.w3c.dom.Document doc,
java.lang.String encoding,
boolean pretty)
Formatting an XML document to a String
|
static void |
formatDocument(org.w3c.dom.Document doc,
java.lang.String encoding,
boolean pretty,
java.io.Writer writer)
Formatting an XML document to a stream.
|
static byte[] |
formatDocumentToByteArray(org.w3c.dom.Document doc,
java.lang.String encoding,
boolean pretty)
Formatting an XML document to a byte array
|
static javax.xml.transform.TransformerFactory |
newTransformerFactory()
Creates a new instance of TransformerFactory.
|
static javax.xml.stream.XMLEventFactory |
newXMLEventFactory()
Creates a new instance of the StAX XMLEventFactory.
|
static javax.xml.stream.XMLInputFactory |
newXMLInputFactory()
Creates a new instance of the StAX XMLInputFactory.
|
static javax.xml.stream.XMLOutputFactory |
newXMLOutputFactory()
Creates a new instance of the StAX XMLOutputFactory.
|
static org.w3c.dom.Document |
parseDocument(org.xml.sax.InputSource input)
Parses an XML document from a strem
|
public static javax.xml.transform.TransformerFactory newTransformerFactory()
fnd.transformerFactory
.If this property has not been set the behavior is exactly as for javax.xml.transform.TransformerFactory.newInstance().
public static javax.xml.stream.XMLInputFactory newXMLInputFactory() throws javax.xml.stream.FactoryConfigurationError
javax.xml.stream.FactoryConfigurationError
- if an instance of this factory cannot be loadedpublic static javax.xml.stream.XMLOutputFactory newXMLOutputFactory() throws javax.xml.stream.FactoryConfigurationError
javax.xml.stream.FactoryConfigurationError
- if an instance of this factory cannot be loadedpublic static javax.xml.stream.XMLEventFactory newXMLEventFactory() throws javax.xml.stream.FactoryConfigurationError
javax.xml.stream.FactoryConfigurationError
- if an instance of this factory cannot be loadedpublic static void formatDocument(org.w3c.dom.Document doc, java.lang.String encoding, boolean pretty, java.io.Writer writer) throws java.io.IOException
doc
- The xml documentencoding
- The encoding of the document (example "UTF-8")pretty
- Flag that set format style of the xml-string to prettywriter
- Writer that writes the serialized document to the output streamjava.io.IOException
public static java.lang.String formatDocument(org.w3c.dom.Document doc, java.lang.String encoding, boolean pretty) throws java.io.IOException
doc
- The xml documentencoding
- The encoding of the document (example "UTF-8")pretty
- Flag that set format style of the xml-string to prettyjava.io.IOException
public static byte[] formatDocumentToByteArray(org.w3c.dom.Document doc, java.lang.String encoding, boolean pretty) throws java.io.IOException
doc
- The xml documentencoding
- The encoding of the document (example "UTF-8")pretty
- Flag that set format style of the xml-string to prettyjava.io.IOException
public static org.w3c.dom.Document parseDocument(org.xml.sax.InputSource input) throws java.io.IOException
input
- Serialized XML documentjava.io.IOException
public static org.w3c.dom.Element findElement(org.w3c.dom.Element parent, java.lang.String tagName, boolean deep)
parent
- The parent elementtagName
- The tagName to search fordeep
- If false only direct children (one level)