commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Mitev" <adrian.mi...@googlemail.com>
Subject [Digester] Question about digester rules
Date Thu, 30 Nov 2006 13:42:46 GMT
Hi all. I got the following XML

<regex-validators>
 <regex-validator>
        <type>digitField</type>
        <expression>\d+</expression>
        <messags>
          <message>
            <local>en</local>
            <text>Only digit values are allowed</text>
          </message>
        </messags>
 </regex-validator>
</regex-validators>

Here is my bean

public class RegexValidatorType {

    private String expression;

    private HashMap messages;

    private String type;

    //getters and settters here
 ........
}

I want to strore All regex-validators in ArrayList of RegexType bean and to
store the messages in HashMap with key <local> and value <text>. How to do
that inserting in the map with digester?


This is my code without the messages mapping:

digester.addObjectCreate("regex-validators", ArrayList.class);
digester.addObjectCreate("regex-validators/regex-validator",
RegexValidatorType.class);
digester.addBeanPropertySetter("regex-validators/regex-validator/type",
"type");
digester.addBeanPropertySetter("regex-validators/regex-validator/expression",
"expression");
digester.addSetNext("regex-validators/regex-validator", "add");

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message