camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <>
Subject Re: [DISCUSS] XPath language improvements
Date Mon, 19 Dec 2011 19:08:11 GMT
Hi there,

I have created the following umbrella ticket to group all XPath

I'll take a look at intelligent namespace handling, such that if the XML
doc is defined under a single default namespace and no more namespaces are
used, assume that the XPath expression is to be evaluated against that

AFAIR, it is possible to specify a wildcard namespace in XPath expressions
(i.e. //*:orders), but not sure if that is limited to XPath 2.0.

Looking at the source code I have found that a defaultXPathFactory is
initialised statically within XPathBuilder and thus is available
system-wide. All XPath expressions default to this factory if another XPath
Factory is not injected in each individual expression. This is perfectly
fine, but what is weird is that the Object Model URI and the Saxon flag
(which are specified *on an individual expression*) are used to determine
the system-wide Default XPath Factory.

IMHO this could cause a race condition if you have different routes some of
them expecting to use the platform default XPath Factory, and other
expecting to use Saxon, because potentially the first route that is
initialised will determine which implementation will be the default factory.

What do you think?


On 17 December 2011 09:52, Claus Ibsen <> wrote:

> On Fri, Dec 16, 2011 at 3:19 PM, Raul Kripalani <>
> wrote:
> > Hi there,
> >
> > I'm working on, and
> since
> > I'm touching the XPath Language, just wanted to check with the community
> if
> > there is anything else that needs to be added/changed there.
> >
> Sometime the camel-scala DSL need changes as well.
> > Claus suggested improving the Namespace support to make it easier for
> users
> > to declare namespaces. Can someone briefly describe what kind of issues
> > users are encountering, and any suggestions? (I don't recall having
> issues
> > myself...).
> >
> If you have a XML structure with a namespce, then the XPath expression
> must be bound to that namespace as well.
> This is a common mistake.
> <order xmlns="">
>   ...
> </order>
> Then the xpath expression must use the htt:// namespace.
> But what would have been cool, would be for Camel to be able to detect
> if you do not have any namespace in the xpath expression.
> And that the XML Structure have 1 namespace assigned in the root tag,
> then we could auto default and use that namespace.
> I have tried to look into this in the past if that was possible. But
> the XPath API did not offer any way back then.
> Another problem is we should possible add some more logging/tracing of
> the evaluation process.
> As when people get the xpath wrong, they do not know what is happening
> and why its wrong.
> And it can take some time to figure this out.
> So if there was some way of enabling logging or just that we have more
> DEBUG logging in the xpath builder then that is a good start.
> > Anything else springs to mind?
> >
> > Regards,
> > Raúl.
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email:
> Web:
> Twitter: davsclaus, fusenews
> Blog:
> Author of Camel in Action:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message