You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Grant McDonald (JIRA)" <ji...@apache.org> on 2006/08/10 14:51:23 UTC

[jira] Created: (SM-530) Update of New Validation Component Error Handler to add in a namespace prefix

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

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

        

[jira] Closed: (SM-530) Update of New Validation Component Error Handler to add in a namespace prefix

Posted by "Grant McDonald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-530?page=all ]

Grant McDonald closed SM-530.
-----------------------------

    Resolution: Won't Fix

Thanks for the feedback :)  after looking into it some more I find that I agree with you.  The inclusion of prefix definitions on nodes can create other issues with XSL transformation and the XPath issue is more elegantly solved using a PrefixResolver.

> 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

        

[jira] Commented: (SM-530) Update of New Validation Component Error Handler to add in a namespace prefix

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ 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