Package com.helger.schematron.pure.xpath
Class XQueryAsXPathFunctionConverter
java.lang.Object
com.helger.schematron.pure.xpath.XQueryAsXPathFunctionConverter
This class loads XQuery modules and provides a list of XPath functions. This
class can only be used, if Saxon is on the classpath!
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault ctor using the current working directory as the base URL for the XQuery resource resolver.XQueryAsXPathFunctionConverter(File aBasePath) Constructor using the passed file as a working directory as the base URL for the XQuery resource resolver.XQueryAsXPathFunctionConverter(String sBaseURL) Constructor using the passed URL as a working directory as the base URL for the XQuery resource resolver. -
Method Summary
Modifier and TypeMethodDescriptioncom.helger.xml.xpath.MapBasedXPathFunctionResolverloadXQuery(InputStream aXQueryIS) Load XQuery functions from an input stream.
-
Constructor Details
-
XQueryAsXPathFunctionConverter
Default ctor using the current working directory as the base URL for the XQuery resource resolver.- Throws:
MalformedURLException- In case the conversion to URL failed
-
XQueryAsXPathFunctionConverter
Constructor using the passed file as a working directory as the base URL for the XQuery resource resolver.- Parameters:
aBasePath- Base path for XQuery resource resolving. May not benull.- Throws:
MalformedURLException- In case the conversion to URL failed
-
XQueryAsXPathFunctionConverter
Constructor using the passed URL as a working directory as the base URL for the XQuery resource resolver.- Parameters:
sBaseURL- Base URL for XQuery resource resolving. May neither benullnor empty.
-
-
Method Details
-
getBaseURL
- Returns:
- The base URL provided in the constructor. Neither
nullnor empty.
-
loadXQuery
@Nonnull public com.helger.xml.xpath.MapBasedXPathFunctionResolver loadXQuery(@Nonnull @WillClose InputStream aXQueryIS) throws net.sf.saxon.trans.XPathException, IOException Load XQuery functions from an input stream. As this function is supposed to work with Saxon HE, this method allows only for loading full XQuery modules and not for XQuery libraries.- Parameters:
aXQueryIS- The Input Stream to read from. May not benull. Will be closed automatically in this method.- Returns:
- A non-
nullMapBasedXPathFunctionResolvercontaining all loaded functions. - Throws:
net.sf.saxon.trans.XPathException- if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or any other static error is reported.IOException- if a failure occurs reading the supplied input.
-