Actions
Bug #4567
closedFailure trying to return a JDOM2 document from a reflexive extension function
Start date:
2020-06-02
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Platforms:
Description
The following test case:
public static JDOM2DocumentWrapper parseToJdom(XPathContext context, String content) throws Exception {
SAXBuilder builder = new SAXBuilder();
Document document = builder.build(new StringReader(content));
return new JDOM2DocumentWrapper(document, context.getConfiguration());
}
public void testJDOM2extension() {
try {
Processor proc = new Processor(true);
XQueryEvaluator eval = proc.newXQueryCompiler().compile(
"Q{java:jaxptest.ExtensionTest}parseToJdom('<magic/>')//*/name()").load();
XdmValue result = eval.evaluate();
assertEquals("magic", ((XdmAtomicValue) result).getStringValue());
} catch (SaxonApiException e) {
e.printStackTrace();
fail();
}
}
fails with the exception:
Error on line 1 column 43
Unknown source class net.sf.saxon.option.jdom2.JDOM2DocumentWrapper
net.sf.saxon.s9api.SaxonApiException: Unknown source class net.sf.saxon.option.jdom2.JDOM2DocumentWrapper
at net.sf.saxon.s9api.XQueryEvaluator.evaluate(XQueryEvaluator.java:434)
at jaxptest.ExtensionTest.testJDOM2extension(ExtensionTest.java:392)
...
Caused by: net.sf.saxon.trans.XPathException: Unknown source class net.sf.saxon.option.jdom2.JDOM2DocumentWrapper
at net.sf.saxon.Configuration.buildDocumentTree(Configuration.java:4171)
at net.sf.saxon.expr.JPConverter$FromSource.convert(JPConverter.java:674)
at net.sf.saxon.expr.JPConverter$FromSource.convert(JPConverter.java:664)
at com.saxonica.expr.JavaExtensionFunctionCall.asSequence(JavaExtensionFunctionCall.java:665)
at com.saxonica.expr.JavaExtensionFunctionCall.call(JavaExtensionFunctionCall.java:576)
at com.saxonica.expr.JavaExtensionFunctionCall.iterate(JavaExtensionFunctionCall.java:445)
Please register to edit this issue
Actions