Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-500

Attributes in xml config should apply to all entries of a list

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0
    • Component/s: Expression engine
    • Labels:
      None
    • Environment:

      Linux, Windows

      Description

      If you have an XML configuration with lists and attributes like this:

      <configuration>
             <someStrings environment="test">str1,str2,str3</someStrings>
             <someStrings environment="prod">str4,str5,str6</someStrings>
      </configuration>
      

      and if you have a different implementation of the DefaultExpressionEngine which implements the query() methode to check these attributes

             List<ConfigurationNode> queryResults = super.query(root, key);
             for (ConfigurationNode queryResult : queryResults) {
                 attributes = queryResult.getAttributes();
                 ...
             }
      

      than you'll only get the attributes for the first node of the list - the
      subsequent nodes don't have any attributes set.
      So for "str1" I'll get the attribute environment="test", for "str2"
      and "str3" I'll get no attributes.

      Oliver H. pointed out that this is the intended behaviour (http://mail-archives.apache.org/mod_mbox/commons-user/201205.mbox/browser).

      I think it would be more straightforward assigning attributes to all nodes of a list. Otherwise the list feature seems incomlete to me.
      Especially if your lists are a bit longish it would be very nice to avoid repeating tags in your config.xml.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Oliver Heger
            Reporter:
            Alex Selg
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development