On 8/20/01 1:24 PM, "robert burrell donkin" <[EMAIL PROTECTED]> wrote:

> 
> On Monday, August 20, 2001, at 04:42 PM, Jason van Zyl wrote:
> 
>> On 8/20/01 11:29 AM, "Jason van Zyl" <[EMAIL PROTECTED]> wrote:
>> 
>>> Hi,
>>> 
>>> I have prepared a little test bundle for the problem I've been having
>>> with parsing attributes with the digester:
>>> 
>>> http://jakarta.apache.org/~jvanzyl/digester-tester.tgz
>>> 
>>> I say possible show stopper because I am still relatively inexperienced
>>> with
>>> the digester but it appears to me that you cannot use the following
>>> sequence
>>> with an error occuring:
>> 
>> Correction: you can't use the following sequence more than once without an
>> error occuring. The common morning lack-of-coffee problem.
>> 
>> 
>>> addMethodCall
>>> addCallParam
>>> 
>>> where the parameter to be used is taken from an attribute.
>>> 
>>> I have the following little file in the test bundle:
>>> 
>>> <a attrA1="attrA1" attrA2="attrA2">
>>> <b attrB1="attrB1" attrB2="attrB2"/>
>>> </a>
>>> 
>>> It seems I cannot use that sequence more than once during the whole
>>> process.
>>> I realize in the above example I could use setProperties, but in the
>>> application I'm using this the attribute names don't match any object
>>> properties so I need to use the methodcall/paramcall pairs.
>>> 
>>> The test bundle illustrates the problem I believe. If I have set
>>> something
>>> up incorrectly, my apologies.
> 
> hi jason
> 
> i think you're right - since the attributes are pushed onto the stack, you
> can only use this once per object at the moment. from what i can see
> (maybe craig or scott will come up with something) this is a consequence
> of the design and there isn't an easy patch.

Really? Craig, any comments? I guess I'll delve into the code, but couldn't
subsequent calls to addMethodCall reset the stack in some fashion so that it
works repeatedly?
 
> the good thing is that digester is extensible and one easy way round this
> problem would be to create a rule that allowed a property with a different
> name (from the attribute) to be set. if this is what you need, i can easy
> and quickly produce a new rule to do just this.

Sure, that would be cool if you want to give it a shot. Take a look at the
project descriptors in gump to see what I'm trying to do.
 
> (if that's not what you need an alternative is to use an objectcreaterule
> and use an implementation of the factory to call a constructor which sets
> the properties you need.)

The rule should probably do the trick :-)
 
> - robert
> 
> 
> 
> 
> 
> 

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons


Reply via email to