commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Stoll <matthias.st...@hpigmbh.com>
Subject DIGESTER: object creation and passing nodes to sub object
Date Mon, 05 Nov 2007 11:42:06 GMT
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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message