public class XMLUtil extends Object
| Constructor and Description |
|---|
XMLUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Document |
createNewDocument()
Creates a new and empty XML document
|
static Element |
getFirstElement(Node parent)
Gets the first element of a Node
|
static String |
getFirstTextValueFromNodeList(NodeList nList)
Gets the first text value of a NodeList
|
static String |
printXML(Node node)
Transforms an XML to a String
|
static Element |
stringToDOM(String xmlString)
Transforms a string representation to a DOM representation
|
static void |
writeXmlFile(Element doc,
String filename)
Writes an XML element to a given file
|
public static Element stringToDOM(String xmlString) throws ParserConfigurationException, SAXException, IOException
xmlString - XML as stringParserConfigurationExceptionSAXExceptionIOExceptionpublic static Document createNewDocument() throws ParserConfigurationException
ParserConfigurationExceptionpublic static String printXML(Node node)
node - XML nodepublic static void writeXmlFile(Element doc, String filename)
doc - XML elementfilename - Filename of the file where to write XMLpublic static String getFirstTextValueFromNodeList(NodeList nList)
nList - NodeListCopyright © 2017. All rights reserved.