commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <simon.kitch...@chello.at>
Subject Re: DIGESTER: object creation and passing nodes to sub object
Date Tue, 06 Nov 2007 09:41:22 GMT
Hi Matthias,

You might like to have a look at the "plugins" module for digester. It allows the rules to
be dynamically expanded.

I don't know if it's exactly what you're looking for, but it is close. I cannot remember for
the moment whether it supports xml rules or not.

As far as I am aware there is nothing else similar for Digester.

BTW, I don't personally like xml rules much: http://wiki.apache.org/jakarta-commons/Digester/FAQ/XmlRulesOrNotXmlRules

Regards,

Simon

---- Matthias Stoll <matthias.stoll@hpigmbh.com> schrieb:
> Hi.
> 
> We want to parase a xml file into corresponding objects via digester. Here 
> 
> 
> is our idea:
> 
> Lets say, we have a object CAR wich has several "Sub" Object, e.g. 
> FUELTYPE and ENGINE etc.
> 
> CAR
>    |
>    |- FUELTYPE
>    |   |- TYPE 1
>    |   |- TYPE 2
>    |
>    |- ENGINE
>    |   |- 2 LITRE
>    |   |- 2.2 LITRE
> 
> We want to define a digester ruleset (XML) for each object, so that car 
> has a ruleset which passes all content of element FUELTYPE to the 
> digesterRuleset for the FUELTYPE object. We imagine such thing as a 
> similar ruleset:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <digester-rules>
>   <pattern value="CAR">
>     <object-create-rule classname="Car" />
>     <call-method-rule pattern="abc" methodname="setABC" paramcount="0"/>
>     <"WHATEVER COMES HERE ELEMENT" methodname="fromXML" 
> object-name="FUELTYPE" /> 
>     <"WHATEVER COMES HERE ELEMENT" methodname="fromXML" 
> object-name="ENGINE" /> 
>   </pattern>
> </digester-rules>
> 
> Result is a complete CAR object containing a FUELTYPE object and a ENGINE 
> object. Where each Object and Subobject has its own fromXML routines 
> configurable via a digester ruleset in XML.
> 
> Is this possible and if so, how?
> 
> THX


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


Mime
View raw message