public class XMLUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
logger |
static Writer |
writer |
| Constructor and Description |
|---|
XMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
displayNodeInfo(Node node) |
static DocumentBuilder |
getDocumentBuilder() |
static String |
getElementByName(Document document,
String name) |
static Node |
getNodeWithXpath(Object obj,
String expression) |
static Document |
parse(InputStream stream) |
static Document |
parse(String xmlString) |
static void |
prettyPrint(String xml) |
static String |
prettyPrintToString(String xml) |
static void |
serializeDoc(Document doc) |
static String |
serializeDoctoString(Document doc) |
static void |
serializeNode(Node node) |
public static Writer writer
protected static final org.apache.commons.logging.Log logger
public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
ParserConfigurationExceptionpublic static Document parse(String xmlString) throws IOException, SAXException, ParserConfigurationException
xmlString - XML StringIOExceptionSAXExceptionParserConfigurationExceptionpublic static Document parse(InputStream stream) throws IOException, SAXException, ParserConfigurationException
stream - Input streamIOExceptionSAXExceptionParserConfigurationExceptionpublic static String getElementByName(Document document, String name)
document - DOM Documentname - Namepublic static void serializeDoc(Document doc) throws IOException
doc - DOM DocumentIOExceptionpublic static String serializeDoctoString(Document doc) throws IOException
IOExceptionpublic static void prettyPrint(String xml)
xml - XML Stringpublic static String prettyPrintToString(String xml)
xml - XML Stringpublic static void displayNodeInfo(Node node)
node - DOM Nodepublic static void serializeNode(Node node) throws IOException
node - DOM NodeIOExceptionCopyright © 2021. All rights reserved.