Details
-
Type:
Sub-task
-
Status: Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.10.0
-
Component/s: camel-core, camel-spring
-
Labels:None
-
Patch Info:Patch Available
-
Estimated Complexity:Unknown
Description
Create a new option traceNamespaces which audits/analyses/extracts all namespaces present in the incoming message and logs them out, in order to help detect potential issues with namespace referencing in XPath expressions.
Since JAXP doesn't provide any mechanism to discover namespaces, this behaviour should be implemented with an XPath query.
To be used only in development mode, as the entire XML document will be traversed in order to discover the [prefix -> namespace URI/URL] pairs.
The default namespace should be discovered and output too.
For each message, if the traceNamespaces option is active, Camel should dump a line similar to the following:
E.g.:
If a prefix is declared multiple times, two things can happen:
- The prefix is always bound to the same namespace
- The prefix is bound to different namespaces in different parts of the XML document
In the first case, the duplicate should be eliminated in the log line. In the second case, the prefix should appear bound to all unique namespaces (see prefix nsa in the above example).
Additionally, when a new XPath expression / predicate is initialised, Camel should dump the NamespaceContext of the expression, so that the user can then compare the namespaces known by the expression against the namespaces that exist in the incoming message.