Package org.webharvest.utils
Class XmlUtil
- java.lang.Object
-
- org.webharvest.utils.XmlUtil
-
public class XmlUtil extends Object
XML utils - contains common logic for XML handling
-
-
Constructor Summary
Constructors Constructor Description XmlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ListVariable
createListOfXmlNodes(net.sf.saxon.query.XQueryExpression exp, net.sf.saxon.query.DynamicQueryContext dynamicContext)
Creates list variable of resulting XML nodes.static ListVariable
evaluateXPath(String xpath, String xml, RuntimeConfig runtimeConfig)
Evaluates specified XPath expression against given XML text and using given runtime configuration.static <T> T
evaluateXPath(String xPathExpression, Document document)
static SAXParserFactory
getSAXParserFactory(boolean validating, boolean nsAware)
static Document
parse(InputSource is)
static String
prettyPrintXml(String xmlAsString)
static void
prettyPrintXml(Document doc, Writer writer)
static void
refreshSchemaResolver()
Force refresh of the schema resolver to pick up XSD changes.
-
-
-
Method Detail
-
parse
public static Document parse(InputSource is)
-
evaluateXPath
public static ListVariable evaluateXPath(String xpath, String xml, RuntimeConfig runtimeConfig) throws net.sf.saxon.trans.XPathException
Evaluates specified XPath expression against given XML text and using given runtime configuration.- Parameters:
xpath
-xml
-runtimeConfig
-- Returns:
- Instance of ListVariable that contains results.
- Throws:
net.sf.saxon.trans.XPathException
-
createListOfXmlNodes
public static ListVariable createListOfXmlNodes(net.sf.saxon.query.XQueryExpression exp, net.sf.saxon.query.DynamicQueryContext dynamicContext) throws net.sf.saxon.trans.XPathException
Creates list variable of resulting XML nodes.- Parameters:
exp
-dynamicContext
-- Returns:
- Throws:
net.sf.saxon.trans.XPathException
-
getSAXParserFactory
public static SAXParserFactory getSAXParserFactory(boolean validating, boolean nsAware)
-
refreshSchemaResolver
public static void refreshSchemaResolver()
Force refresh of the schema resolver to pick up XSD changes.
-
-