Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-173

[configuration] Missing useful functionality of XPath in HierarchicalConfiguration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 35753

    Description

      Hi,

      I find out that there is missing very usefull functionality for
      org.apache.commons.configuration.HierarchicalConfiguration.

      For instance, I have XML like below:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration>
      <Service name="contract.funds" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeFunds_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeFunds_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeFunds_rules.xml" />
      </ServiceParameters>
      </Service>

      <Service name="contract.servicing.agents" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeServicingAgents_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeServicingAgents_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeServicingAgents_rules.xml" />
      </ServiceParameters>
      </Service>

      <Service name="contract.additional.info" class="my.MyClass">
      <ServiceParameters>
      <Param key="generate.request" value="true" />
      <Param key="request.xml.name"
      value="LifeAdditionalInfo_REQ.xml" />
      <Param key="transform.response" value="true" />
      <Param key="reply.xml.name"
      value="dummy/LifeAdditionalInfo_REP.xml" />
      <Param key="digester-rules.xml"
      value="LifeAdditionalInfo_rules.xml" />
      </ServiceParameters>
      </Service>
      </Configuration>

      From the application I would like to go directly to the configuration of
      service with name: "contract.funds" instead of reading whole hierarhi and check
      if the name is equals "contract.funds" I prefer to get its parameters like this:

      config.getProperty("Service[@name='contract.funds']").ServiceParameters.Param)

      instead of calling in a loop:

      for(int i=0;;i++){
      if(config.getProperty("Service("i")[@name]").equals("contract.funds"))

      { // DO SOMETHING }

      }

      So in a simple words - it would be very helpfull if there will be full
      supoorted the XML Path Language (XPath) during requesting properties.

      Best regards
      Rafal

      Attachments

        Activity

          People

            Unassigned Unassigned
            rzablocki@wp.pl Rafal Zablocki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: