You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Anton Maslovsky <an...@hotmail.com> on 2003/10/07 09:47:11 UTC

[Digester][PATCH] ObjectParamRule support for XML rules

Hi,

I've added support for the ObjectParamRule in XML rules file for the 
Digester. The syntax is as follows:

<!--
    ObjectParamRule
    attrname - an arbitrary Object defined programatically, assigned if the 
element pattern AND specified attribute name are matched
    param - an arbitrary Object defined programatically, assigned when the 
element pattern associated with the Rule is matched
    type - class name for object
    value - initial value for the object
    -->
<!ELEMENT object-param-rule EMPTY>
<!ATTLIST object-param-rule
    pattern  CDATA #IMPLIED
    paramnumber CDATA #REQUIRED
    param CDATA #REQUIRED
    attrname CDATA #IMPLIED
    type CDATA #REQUIRED
    value CDATA #IMPLIED>

XML example:

<object-param-rule paramnumber="0" type="java.lang.String" 
value="meter.serial"/>

Generaly, type attribute can be any Java type. The value can be a string 
representation of any type that stnaddard ConvertUtils classes are capable 
to convert into the corresponding object instance.

Tow files are patched:

DigesterRuleParser.java
digester-rules.dtd

Regards,
Anton

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

Re: [Digester][PATCH] ObjectParamRule support for XML rules

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
Looks cool...

Maybe it would be a good idea to provide a unit test for this new
functionality too [if you have time]?

[nb: I'm not a committer/maintainer].

Regards,

Simon

On Tue, 2003-10-07 at 20:47, Anton Maslovsky wrote:
> Hi,
> 
> I've added support for the ObjectParamRule in XML rules file for the 
> Digester. The syntax is as follows:
> 
> <!--
>     ObjectParamRule
>     attrname - an arbitrary Object defined programatically, assigned if the 
> element pattern AND specified attribute name are matched
>     param - an arbitrary Object defined programatically, assigned when the 
> element pattern associated with the Rule is matched
>     type - class name for object
>     value - initial value for the object
>     -->
> <!ELEMENT object-param-rule EMPTY>
> <!ATTLIST object-param-rule
>     pattern  CDATA #IMPLIED
>     paramnumber CDATA #REQUIRED
>     param CDATA #REQUIRED
>     attrname CDATA #IMPLIED
>     type CDATA #REQUIRED
>     value CDATA #IMPLIED>
> 
> XML example:
> 
> <object-param-rule paramnumber="0" type="java.lang.String" 
> value="meter.serial"/>
> 
> Generaly, type attribute can be any Java type. The value can be a string 
> representation of any type that stnaddard ConvertUtils classes are capable 
> to convert into the corresponding object instance.
> 
> Tow files are patched:
> 
> DigesterRuleParser.java
> digester-rules.dtd
> 
> Regards,
> Anton
> 
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
> 
> ______________________________________________________________________
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Digester][PATCH] ObjectParamRule support for XML rules

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
patch applied. many thanks.

i had problems with the patch format. please use (cvs) diff -u in future. 
also please consider contributing (as simon requested) a unit test for the 
submitted code.

- robert

On Tuesday, October 7, 2003, at 08:47 AM, Anton Maslovsky wrote:

> Hi,
>
> I've added support for the ObjectParamRule in XML rules file for the 
> Digester. The syntax is as follows:
>
> <!--
>    ObjectParamRule
>    attrname - an arbitrary Object defined programatically, assigned if 
> the element pattern AND specified attribute name are matched
>    param - an arbitrary Object defined programatically, assigned when the 
> element pattern associated with the Rule is matched
>    type - class name for object
>    value - initial value for the object
>    -->
> <!ELEMENT object-param-rule EMPTY>
> <!ATTLIST object-param-rule
>    pattern  CDATA #IMPLIED
>    paramnumber CDATA #REQUIRED
>    param CDATA #REQUIRED
>    attrname CDATA #IMPLIED
>    type CDATA #REQUIRED
>    value CDATA #IMPLIED>
>
> XML example:
>
> <object-param-rule paramnumber="0" type="java.lang.String" 
> value="meter.serial"/>
>
> Generaly, type attribute can be any Java type. The value can be a string 
> representation of any type that stnaddard ConvertUtils classes are 
> capable to convert into the corresponding object instance.
>
> Tow files are patched:
>
> DigesterRuleParser.java
> digester-rules.dtd
>
> Regards,
> Anton
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
>   ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org