[ 
https://issues.apache.org/activemq/browse/CAMEL-3155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62109#action_62109
 ] 

Claus Ibsen edited comment on CAMEL-3155 at 9/26/10 1:36 AM:
-------------------------------------------------------------

And no I could not find a solution with the XPath API to let it be aware of the 
default namesapce. There seems to be no good hooks for such kind.

Even if I added what may be a default namespace to the NamespaceContext the 
xpath would still fail. The only solution I could get working is to use 
namespace prefixes in the xpath expressions.

And the XPathExpression does not offer any callbacks or hooks to influence the 
compiling. And I bet doing a string based manipulation of the given String for 
the namespace is hard because people can use a lot of different combinations.

So if you have a simple expression like
{code}
/foo/bar
{code}

Then it may be possible to manipulate it beforehand and do
{code}
/c:foo/c:bar
{code}

And register c as a namespace with the uri from the XML message.

But when the xpath expression becomes more complex, its much harder.

So I wonder there must be better ways that this?

      was (Author: davsclaus):
    And no I could not find a solution with the XPath API to let it be aware of 
the default namesapce. There seems to be no good hooks for such kind.

Even if I added what may be a default namespace to the NamespaceContext the 
xpath would still fail. The only solution I could get working is to use 
namespace prefixes in the xpath expressions.

And the XPathExpression does not offer any callbacks or hooks to influence the 
compiling. And I bet doing a string based manipulation of the given String for 
the namespace is hard because people can use a lot of different combinations.

So if you have a simple expression like
{code}
/foo/bar
{code}

Then it may be possible to manipulate it beforehand and do
{code}
/c:foo/c:/bar
{code}

And register c as a namespace with the uri from the XML message.

But when the xpath expression becomes more complex, its much harder.

So I wonder there must be better ways that this?
  
> Default namespace not handled by .when(xpath(string))
> -----------------------------------------------------
>
>                 Key: CAMEL-3155
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3155
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.4.0
>         Environment: Apache Maven 3.0-alpha-5 (r883378; 2009-11-23 
> 07:53:41-0800)
> Java version: 1.6.0_17
> Java home: C:\Program Files\Java\jdk1.6.0_17\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
>            Reporter: Malachi de AElfweald
>            Assignee: Claus Ibsen
>            Priority: Minor
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> If I do a .choice().when(xpath("//rootnode")) it fails to find any matches 
> unless I preprocess and remove the xmlns="blah" (autogenerated by JAXB on the 
> other end)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to