Camel
  1. Camel
  2. CAMEL-4799 Umbrella ticket for XPath improvements
  3. CAMEL-4852

Extra logging when evaluating XPath expressions to help address namespace issues

    Details

    • Type: Sub-task Sub-task
    • Status: Resolved
    • Priority: Major 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.:

      {xmlns:nsb=[http://namespaceb.net], xmlns:nsa=[http://namespacec.net, http://namespacea.net], DEFAULT=[http://defaultNamespace.net]}

      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.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Raúl Kripalani
            Reporter:
            Raúl Kripalani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development