Add an addNamespaces(OMElement) method to AXIOMXPath
----------------------------------------------------

                 Key: WSCOMMONS-333
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-333
             Project: WS-Commons
          Issue Type: Improvement
          Components: AXIOM
            Reporter: Andreas Veithen
            Priority: Minor


Very often, XPath expressions are read from XML configuration files, in which 
case such an XPath expression typically appears as an attribute value. In this 
case the namespace context of the XPath expression is determined by the 
namespace declarations in scope on the element which has the attribute in which 
the expression occurs.

Example:

<configfile xmlns:ns="http://example.org";>
  <someelement expression="//ns:something"/>
</configfile>

In this case, the "ns" prefix in the expression "//ns:something" is expected to 
be bound to "http://example.org";. It would be useful to have a method 
addNamespaces(OMElement) in AXIOMXPath that sets up the namespace context of 
the XPath expression based on the namespace declaration of the given OMElement 
(corresponding to "someelement" in the example above).

There is already some code in Synapse that does this (see the addNameSpaces 
method):

http://svn.apache.org/repos/asf/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/OMElementUtils.java

Since this might be useful to others, AXIOMXPath would be a better place to 
have this code.

-- 
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