[ 
https://issues.apache.org/activemq/browse/SM-530?page=comments#action_36749 ] 
            
Guillaume Nodet commented on SM-530:
------------------------------------

If the xml use a default namespace declaration 
(xmlns="http://www.servicemix.org/demo";),
the xml can still be queried via xpath with
    "//smdemo:messages/*
provided that you configure your xpath expression with the needed namespaces.

When xpath evaluate an expression, the prefix are not used per se.  Prefixes 
are only used to match against the namespaces.
So in your xpath expression, you could use
   //smdemo:messages/*
or
   //tmp:message/*
as long as both tmp and smdemo are mapped to "http://www.servicemix.org/demo"; 
in your xpath expression namesapce context
  

> Update of New Validation Component Error Handler to add in a namespace prefix
> -----------------------------------------------------------------------------
>
>                 Key: SM-530
>                 URL: https://issues.apache.org/activemq/browse/SM-530
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-components
>         Environment: Ubuntu Linux 5.10, Windows XP SP2, ServiceMix HEAD
>            Reporter: Grant McDonald
>         Attachments: servicemix-components.zip
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> I realised that without a namespace prefix the XML generated by the 
> MessageAwareErrorHandler will not be accessible via xpath.  An example of 
> this:
> <Fault xmlns="http://www.servicemix.org/demo";>
>     <messages>
>           ....
>    </messages>
> </Fault>
> To retrieve the child elements of the messages node we would need to specify 
> "//messages/*" but with the namespace declared at the top this will return 
> nothing.  Instead the XML should be:
> <Fault xmlns="http://www.servicemix.org/demo"; 
> xmlns:smdemo="http://www.servicemix.org/demo";>
>     <messages>
>           ....
>    </messages>
> </Fault>
> and the xpath "//smdemo:messages/*
> The provided patch adds this functionality and updates the example.xml test 
> resource.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to