public class XMLUtils extends Object
A Utility class containing methods to write and transform XML objects.
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addAttribute(Document doc,
Element node,
String name,
String value) |
static Element |
addNode(Document doc,
Node parent,
String name) |
static void |
addNode(Document doc,
Node parent,
String name,
String text) |
static void |
addNode(Document doc,
Node parent,
String ns,
String name,
String text,
Map NS_MAP) |
static Document |
getDocumentRoot(InputStream is) |
static String |
getElementText(String elemName,
Element root) |
static String |
getElementText(String elemName,
Element root,
boolean trim) |
static Element |
getFirstElement(String name,
Element root) |
static String |
getSimpleElementText(Element node) |
static String |
getSimpleElementText(Element node,
boolean trim) |
static String |
read(Element root,
String elt) |
static String |
read(Element root,
String elt,
String encoding) |
static List |
readMany(Element root,
String elt) |
static List |
readMany(Element root,
String elt,
String encoding) |
static void |
writeXmlFile(Document doc,
String filename)
This method writes a DOM document to a file
|
static void |
writeXmlToStream(Document doc,
OutputStream stream) |
public static void writeXmlFile(Document doc, String filename)
This method writes a DOM document to a file
.doc
- The DOM document to write.filename
- The filename to write the DOM document to.public static void writeXmlToStream(Document doc, OutputStream stream)
public static Document getDocumentRoot(InputStream is)
public static void addNode(Document doc, Node parent, String ns, String name, String text, Map NS_MAP)
Copyright © 1999–2017 Apache OODT. All rights reserved.