camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raul Kripalani (Commented) (JIRA)" <>
Subject [jira] [Commented] (CAMEL-4852) Extra logging when evaluating XPath expressions to help address namespace issues
Date Tue, 03 Jan 2012 12:14:39 GMT


Raul Kripalani commented on CAMEL-4852:

Patch attached in CAMEL-4799.

All new logging output in TRACE level.

Namespace auditing in incoming message can be activated in Spring DSL by setting the traceNamespaces
attribute to true (traceNamespace=true) or in Java DSL by using .traceNamespaces().

Tricky part was the unit test. To verify that the logging occurs, I mocked out the SLF4j Logger
using EasyMock and replaced the private static final LOG variable in XPathBuilder via Java
Reflection. All this is done in {{org.apache.camel.builder.xml.XPathTransformTest}}.
> Extra logging when evaluating XPath expressions to help address namespace issues
> --------------------------------------------------------------------------------
>                 Key: CAMEL-4852
>                 URL:
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-core, camel-spring
>            Reporter: Raul Kripalani
>             Fix For: 2.10
> 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.: {xmlns:nsb=[], xmlns:nsa=[,],
> 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
> 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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message