You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "M, Manohar IN BLR STS" <ma...@siemens.com> on 2014/05/13 13:59:44 UTC
[digester] Default value for boolean argument in call param rule
Hello,
Greetings!
We have a project which is migrated from digester version 1.8 to 3.0.
In earlier version, when no argument was passed within xml parsed by digester for a Boolean argument, it was considering true by default.
But, in digester 3.0, its observed that, default value for any argument which is not passed is set to false.
For eg:
<pattern value="begSeparator">
<call-method-rule methodname="addXXXX" paramcount="4"
paramtypes="java.lang.String,java.lang.Boolean,java.lang.String,java.lang.String" />
<call-param-rule paramnumber="0" attrname="separator" />
<call-param-rule paramnumber="1" attrname="includeIfNull"/>
<call-param-rule paramnumber="2" attrname="escapeString" />
<call-param-rule paramnumber="3" attrname="escapeSwitch" />
</pattern>
In the earlier version, this was set to true if includeIfNull is not present in the xml file.
In the xml file:
<begSeparator separator="/" />
(As you see, there is no includeIfNull attribute)
This is how, digester is being initialized:
Digester digester = newLoader( createRules( _registerHelper.registerEarResource(rule) ) ).newDigester();
digester.push(object);
//Set the SAX parser attributes
digester.setErrorHandler(new SASErrorHandler());
//setValidatRing is not required as it triggers dtd validation, refer digester doc
digester.setNamespaceAware(true);
//use dynamic schema validation
digester.setFeature("http://apache.org/xml/features/validation/dynamic",true);
digester.setFeature("http://apache.org/xml/features/validation/schema",true);
digester.setXMLSchema(schema);
digester.parse( _registerHelper.registerFile(file).openStream());
Can any of you provide any workaround wherein we can change the default behavior to consider true by default instead of false for any of the non-passed arguments?
Rgds
Manohar