Package org.jboss.windup.util.xml
Class XmlUtil
- java.lang.Object
-
- org.jboss.windup.util.xml.XmlUtil
-
public class XmlUtil extends Object
Contains utility methods for interacting with XML files.
-
-
Constructor Summary
Constructors Constructor Description XmlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectexecuteXPath(Node document, String xpathExpression, Map<String,String> namespaceMapping, QName result)Executes the given xpath and returns the result with the type specified.static ObjectexecuteXPath(Node document, XPathExpression expr, QName result)Executes the givenXPathExpressionand returns the result with the type specified.static Map<String,String>getSchemaLocations(Document doc)Returns the names and locations defined in thisDocument.static StringnodeListToString(NodeList nodeList)static StringnodeToString(Node node)static booleanxpathExists(Node document, String xpathExpression, Map<String,String> namespaceMapping)Runs the given xpath and returns a boolean result.static StringxpathExtract(Node document, String xpathExpression, Map<String,String> namespaceMapping)Runs the given xpath and returns aStringresult.static NodeListxpathNodeList(Node document, String xpathExpression, Map<String,String> namespaceMapping)Runs the given xpath and returns aNodeListresult.static NodeListxpathNodeList(Node document, XPathExpression xpathExpression)Runs the given xpath and returns aNodeListresult.
-
-
-
Method Detail
-
getSchemaLocations
public static Map<String,String> getSchemaLocations(Document doc)
Returns the names and locations defined in thisDocument.
-
xpathExists
public static boolean xpathExists(Node document, String xpathExpression, Map<String,String> namespaceMapping) throws XPathException, MarshallingException
Runs the given xpath and returns a boolean result.- Throws:
XPathExceptionMarshallingException
-
xpathExtract
public static String xpathExtract(Node document, String xpathExpression, Map<String,String> namespaceMapping) throws XPathException, MarshallingException
Runs the given xpath and returns aStringresult.- Throws:
XPathExceptionMarshallingException
-
xpathNodeList
public static NodeList xpathNodeList(Node document, String xpathExpression, Map<String,String> namespaceMapping) throws XPathException, MarshallingException
Runs the given xpath and returns aNodeListresult.- Throws:
XPathExceptionMarshallingException
-
xpathNodeList
public static NodeList xpathNodeList(Node document, XPathExpression xpathExpression) throws XPathException, MarshallingException
Runs the given xpath and returns aNodeListresult.- Throws:
XPathExceptionMarshallingException
-
executeXPath
public static Object executeXPath(Node document, String xpathExpression, Map<String,String> namespaceMapping, QName result) throws XPathException, MarshallingException
Executes the given xpath and returns the result with the type specified.- Throws:
XPathExceptionMarshallingException
-
executeXPath
public static Object executeXPath(Node document, XPathExpression expr, QName result) throws XPathException, MarshallingException
Executes the givenXPathExpressionand returns the result with the type specified.- Throws:
XPathExceptionMarshallingException
-
-