balaji410 opened a new issue, #1332: URL: https://github.com/apache/camel-website/issues/1332
Steps: Java 17 Added below camel dependencies to Maven project <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-soap</artifactId> <version>4.10.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-saxon</artifactId> <version>4.10.0</version> </dependency> <dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>12.5</version> <!-- Use the appropriate Saxon version --> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>4.10.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-bean</artifactId> <version>4.10.2</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-endpointdsl</artifactId> <version>4.10.0</version> </dependency> In Xquery variable declaration: declare variable $configXML as element() external; From camel setting value using camel exchange object: exchange .setProperty("configXML", org.w3c.dom.Document.class) I even tried passing net.sf.saxon.s9api.XdmNode org.w3c.dom.Element All the above options fails with below error Config.xml <config> <referenceOperation>test</referenceOperation> </config> Query(test.xqy) file content: xquery version "1.0" encoding "utf-8"; declare variable $configXML as element() external; declare function local:func($configXML as element()) as element() { <test>{data($configXML/referenceOperation)}</test> }; local:func($configXML) Routing.java public Routing extends EndpointRouteBuilder { @Override public void configure() { from(). process(exchange -> { File currentDirectory = new File("."); Path filePath = Path.of(currentDirectory.getCanonicalPath(), "src", "main", "resources", "Config.xml"); // Read File Contents String fileContent = Files.readString(filePath); net.sf.saxon.s9api.Processor processor = new net.sf.saxon.s9api.Processor(false); net.sf.saxon.s9api.XdmNode xmlNode = processor.newDocumentBuilder() .build(new javax.xml.transform.stream.StreamSource(new java.io.StringReader(fileContent))); // Map<String, String> map = new HashMap<>(); exchange.setProperty("config", xmlNode); }) .to(xquery("file:src/main/resources/test.xqy") .log("Xquery Output :${body}") } ERROR: Caused by: net.sf.saxon.trans.XPathException: The required item type of the value of variable $configXML is element(); the supplied value (XdmNode)<config> <referenceOperatio... is an external object at net.sf.saxon.expr.ItemTypeCheckingFunction.testConformance(ItemTypeCheckingFunction.java:77) at net.sf.saxon.expr.ItemTypeCheckingFunction.mapItem(ItemTypeCheckingFunction.java:55) at net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:161) at net.sf.saxon.expr.CardinalityCheckingIterator.<init>(CardinalityCheckingIterator.java:55) at net.sf.saxon.type.TypeHierarchy.applyFunctionConversionRules(TypeHierarchy.java:233) at net.sf.saxon.expr.instruct.GlobalParameterSet.convertParameterValue(GlobalParameterSet.java:110) at net.sf.saxon.Controller.getConvertedParameter(Controller.java:270) at net.sf.saxon.expr.instruct.GlobalParam.evaluateVariable(GlobalParam.java:71) at net.sf.saxon.expr.GlobalVariableReference.evaluateVariable(GlobalVariableReference.java:131) at net.s f.saxon.expr.GlobalVariableReference$GlobalVariableReferenceElaborator.evaluate(GlobalVariableReference.java:194) at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61) at net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:616) at net.sf.saxon.expr.UserFunctionCall$UserFunctionCallElaborator.lambda$elaborateForPush$5(UserFunctionCall.java:844) at net.sf.saxon.query.XQueryExpression.processQuery(XQueryExpression.java:499) at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:473) at org.apache.camel.component.xquery.XQueryBuilder.evaluateAsDOM(XQueryBuilder.java:227) at org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:187) ... 48 more Please suggest us what's wrong here and how to overcome from it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org