New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xpath with namespaces (XPath 2.0 support) #234
Comments
I used the following XML with NS to conduct related Integration tests:
On June 19 (yesterday) I tested the XPathBuilder handling by defining within the JHipster/Angular Headers as follows: Key label01 with XPath expression value: //[local-name()='transactie']/[local-name()='label']/text() label02 causes: org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: //ns2:label/text(). Reason: javax.xml.xpath.XPathExpressionException: com.sun.org.apache.xpath.internal.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a namespace: ns2 label03 returned only an empty "no result", and label01 is the only expression that returns a viable correct result, albeit that it remains more verbose than the other two label XPath expressions, of course. Conclusion: we have stick to the verbose local-name() for NS-prefix XML tag based XPath / XPathBuilder extraction from the XML (soap) payload to the desired header key values. |
Of course, in the XML above, instead of |
Test the xpath functionality. Now users can use the asterisk * signs |
Currently only default links are supported like this:
/root/somefiled/text()
How sometimes there are namespaces:
/hdr:root/xf:somefiled/text()
The code in Assimbly code connector can be found in this file:
https://github.com/assimbly/connector/blob/master/src/main/java/org/assimbly/connector/routes/DefaultRoute.java
On line 235 the xpath is used
The is xpath on headers. See:
https://github.com/apache/camel/blob/master/components/camel-xpath/src/main/docs/xpath-language.adoc
https://people.apache.org/~dkulp/camel/xpath.html
Preferable the user can use the xpath with namespace without using the url (setting)
The text was updated successfully, but these errors were encountered: