Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-328

Add an addNamespaces(OMElement) method to AXIOMXPath

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.2.8
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            veithen Andreas Veithen
            veithen Andreas Veithen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: