commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernst de Haan <er...@ernstdehaan.com>
Subject Re: [Digester] Generic digester patterns?
Date Fri, 03 Aug 2007 06:48:38 GMT
Simon,


Your in-depth answers are very much appreciated!

> I'm not quite sure what you mean by "re-use" here.
>
> What you're trying to implement isn't that common I think.  
> Generally it
> is known what child xml elements a particular xml element can have, so
> writing explicit rules isn't a problem. Yes, the rules need  
> updating if
> a new child element must be supported, but in general the java code
> needs to be updated anyway (eg to add a new setter method on the  
> parent
> class) and everything needs to then be retested so having to modify  
> the
> digester rules at the same time doesn't seem to me to be a big  
> concern.

Well, in a typical configuration file, there are a lot of common data  
types used. For example, in a configuration file for a user interface:
- text string
- integer number
- color
- font
- etc.

These data types could be used in many different places in the  
document, e.g.:

<Config>
    <Background><Color ... /></Background>
    <TitleText><Font ... /></TitleText>
    <SubtitleText><Font ... /></SubtitleText>
    <LabelText><Font ... /></LabelText>
</Config>

It works when I resort to having one pattern for every higher level  
element (Background, TitleText, etc.). But I would prefer to use  
SetNesterPropertiesRule in combination with matchers for the lower- 
level elements (Color, Font, etc.)

I hope this is a better explanation of what I meant to bring across...

Cheers,


Ernst

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


Mime
View raw message