commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geronimo Ma. Hernandez" <>
Subject Re: [Digester] question about parent-parameter-access
Date Tue, 02 Sep 2003 07:13:11 GMT
Thank you, Simon, for your response and sorry for being not good enuf 
explaining my "problem".

I'm pretty new to digester and XML.
I just have an idea of a model and a way I would like to work with it. So I 
decided to work on a tool to handle the model.

And as I'm not that visionary, I toggle between different roles: the 
tool-developer, the tool-user and the model-"watcher".
Therefore anything changes if all roles agree.

At the moment I don't have a DTD. I startet writing the xml with an editor and 
than thought about how to parse the stuff with the digester-rules.
The xml was just a snippet of the complete model.

Ok, I try to explain some of the backgrounds of this snippet, cause I think 
the code is too much to send. If not, give me a note and I'll send you the 

The file I parse is a meta-model of a database, where each 
attribute-definition is a domain and the entities just use a 
attribute-definition. So first I process the attribute-definitions with a 
class for each attribute-type supported. 

After that I parse the entities.
The "*/entity"-pattern creates an entity-definition. As the attributes are 
only references to already scanned definitions, the attributes are added to a 
map in the entity-definition. At addition, I check the existence of the 
referenced attribute-definition. 
For that purpose I created an ObjectCreationFactory, which sets the name 
attribute and the parent of the entity-definition (at creation, cause as I 
understood the CallMethodRules, they work at the end of a definition and I 
found no method-call which fires before the body-processing).

Ok, when I worked on the index-definitions, I had the choice, to add it as an 
attribute to "*/entity/addAttribute" or create a new rule for that pattern.

I decided to go for the second, cause I thought, the majority of the 
attribute-references won't have any index-declaration. But to add an 
index-declaration, I need the name of the attribute and I didn't 
want to duplicate it in the xml.

Yesterday, when I found the digester.peekParams(n), I gave it a try and 
created a "CallAncestorParamRule", which peeks a param from the 
parameter-stack. This works, and it don't look too ugly, but I'm not sure, 
whether it is in the mood of the digester-stuff?
Ok, I realized, the method is now public accessible - so was it right what I 

If there is another way, on how to do it better, I would appreciate any 
suggestion - even on points, which I think about as being "fixed". 

Hope I could clarify a bit, what I'm trying to do ...


View raw message