Commons Digester
  1. Commons Digester
  2. DIGESTER-39

[digester] Exact patterns overwrite patterns with wildcards

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      In the code below the Rules with the wildcard-patterns don't seem to be fired
      (at least, when using the xml even more below). If the exact matching rules are
      put in comment, the wildcard matching rules do get fired.
      It seems like the SetRoot rule overwrites the ObjectCreate rule.
      Furthermore the pattern "datadescriptor//property" doesn't seem to match
      anywhere, but this may be due to a misunderstanding of the (rather short)
      explanation in the docs.

      yours sincerely,
      Maarten Van Puymbroeck.

      – Java Code –

      // Properties
      // create the object
      digester.addObjectCreate("*/property", RealProperty.class);
      // initialize properties
      String[] properties = new String[]

      {"name", "key", "tooltip", "mapsWith", "type", "ref"}

      ;
      digester.addSetProperties("*/property", properties, properties);
      // add the properties to the correct collection
      digester.addSetRoot("datadescriptor/properties/property", "addProperty");//,
      "be.generic.Property");
      digester.addSetRoot("datadescriptor/searchproperties/property",
      "addSearchProperty");//, "be.generic.Property");
      digester.addSetRoot("datadescriptor/listproperties/property",
      "addListProperty");//, "be.generic.Property");
      digester.addSetRoot("datadescriptor/editproperties/property",
      "addEditProperty");//, "be.generic.Property");

      – XML –

      <?xml version="1.0" encoding="UTF-8"?>
      <!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy.com)-->
      <datadescriptor class="be.dto.LongReturnDTO"
      dataTypeName="GenericExample">
      <actions create="true" update="true" delete="true"/>
      <properties>
      <property name="start_date" key="i-startDate" tooltip="i-startDateTooltip"
      mapsWith="startDate" type="Date" />
      </properties>
      <searchproperties>
      <property name="expiration_date" key="i-expirationDate"
      tooltip="i-expirationDateSearchTooltip" mapsWith="endDate" type="Date" />
      </searchproperties>
      <listproperties>
      <property name="expiration_date" key="i-expirationDate"
      tooltip="i-expirationDateListTooltip" mapsWith="endDate" type="Date" />
      <property ref="start_date" tooltip="i-startDateListTooltip"/>
      </listproperties>
      <editproperties>
      <allProperties />
      </editproperties>
      </datadescriptor>

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Maarten Van Puymbroeck
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development