public final class XmlUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Object |
evalXPath(Node d,
String expr,
QName returnType)
Gets the object at the given XPath in the given XML node.
|
static Object |
evalXPath(String xml,
String expr,
QName returnType)
Gets the object at the given XPath in the given XML string.
|
static String |
xmlDocumentToString(Node d)
Converts an XML document or node to an equivalent string.
|
static Document |
xmlStringToDocument(String xml)
Converts an XML string into an equivalent XML document.
|
public static Object evalXPath(Node d, String expr, QName returnType) throws XPathExpressionException
evalXPath(String, String, javax.xml.namespace.QName).d - the node to look inexpr - the XPath expression to evaluatereturnType - the expected return type of the objectXPathExpressionException - if an error occurs processing the XPath expressionpublic static Object evalXPath(String xml, String expr, QName returnType) throws XPathExpressionException, SAXException, IOException, ParserConfigurationException
evalXPath(org.w3c.dom.Node, String, javax.xml.namespace.QName).xml - the XML string to look inexpr - the XPath expression to evaluatereturnType - expected return type of the objectXPathExpressionException - if an error occurs while processing the XPath expressionSAXException - if an error occurs converting the XML string to an XML nodeIOException - if a general IO error occursParserConfigurationException - if an error occurs configuring the parserpublic static String xmlDocumentToString(Node d) throws TransformerFactoryConfigurationError, TransformerException
xmlStringToDocument(String).d - the node to convertTransformerFactoryConfigurationError - if an error occurs configuring the transformer factoryTransformerException - if an error occurs during the transformationpublic static Document xmlStringToDocument(String xml) throws SAXException, IOException, ParserConfigurationException
xmlDocumentToString(org.w3c.dom.Node).xml - the XML string to convertDocument equivalent to the specified XML stringSAXException - if an error occurs building the XML documentIOException - if a general IO error occursParserConfigurationException - if an error occurs configuring the XML parserCopyright © 2015 Emory University. All rights reserved.