commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Savitsky, Alex" <alex.savit...@Kraft.com>
Subject RE: [Digester] Parsing XML to a hashtable
Date Tue, 02 Mar 2004 21:08:51 GMT
Already did five minutes ago, and it works great :)

One comment I have, though, is that pretty much any parameter-related rule
needs access to "digester.peekParams()" (PathCallParamRule needs it, too),
and that method has package visibility. Thus, I had to declare my custom
rule to be in org.apache.commons.digester package just to access that
method. I wonder if that access restriction was done on purpose, or if
developers just forgot to put "protected" access there, because, IMHO,
"protected" would do better there, allowing to subclass rules without being
forced to put them in certain package...

Anyway, thanks for the tip.

Alex

-----Original Message-----
From: Simon Kitching [mailto:simon@ecnetwork.co.nz]
Sent: Tuesday, March 02, 2004 3:57 PM
To: Jakarta Commons Users List
Subject: RE: [Digester] Parsing XML to a hashtable


On Wed, 2004-03-03 at 08:27, Savitsky, Alex wrote:
> Uhh... now I am confused too...
> 
> So let me get it straight - your suggestion is to create a helper class
> XMLContact with getters/setters for each field in Contact, that would
> capture XML data (instead of Contact doing it) and then push it to Contact
> (using existing hashmap-like interface) at every </Contact> occurrence?
> Well, that's exactly what I was trying to avoid - creating accessors for
> each of 30+ fields (and that number will undoubtely grow in the nearest
> future) separately :( Well, that helper class does simplify it a bit, I'll
> try it...
> 
> Another option that I'm going to try is to create my own extension to
> CallParam rule, which would allow passing tag name as a parameter.
> 
> Anyway, thanks for help.

Hi Alex,

Yes, the easiest solution is just to write your own Rule class.

There is a new class in CVS called "PathCallParamRule". You could grab
this class, and tweak it to use the tagname rather than the current
digester match path. It's a *very* simple class. Or see any of the other
rule classes; the PathCallParamRule class is just the closest match to
what you want.

Regards,

Simon


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

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


Mime
View raw message