commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Simple XML filter for Digester
Date Tue, 29 Jul 2003 01:02:57 GMT


On Mon, 28 Jul 2003, robert burrell donkin wrote:

> Date: Mon, 28 Jul 2003 23:50:17 +0100
> From: robert burrell donkin <robertburrelldonkin@blueyonder.co.uk>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> Subject: Re: Simple XML filter for Digester
>
> hi Aaran
>
> i'm afraid that i don't know of an easy way to do this (currently). the
> pattern matching rules don't look for attributes and anyway can't be
> easily modified dynamically.
>
> this could probably be done using a filter for the SAX events (but that
> might be a little tough since you're new to xml). maybe some kind of
> generic filtering could be added to digester (but i'm not sure how easy
> this would be).
>
> any one else have any good ideas about how to solve this one?
>
> - robert
>
> On Saturday, July 26, 2003, at 03:49 AM, Aaran Stent wrote:
>
> > Hello,
> >
> > I am new to XML, after reading all of the hype I have fond disgester is a
> > actually a practicle way of using XML in a "real world environment".  I
> > have
> > setup a digester object to load select/combo boxes for my application.  A
> > simple XML example follows:
> >
> > <combos>
> > 	<combo name="colour">
> > 		<option id="1" value="blue">
> > 		<option id="2" value="black">
> > 		<option id="3" value="red">
> > 	</combo>
> > 	<combo name="streets">
> > 		<option id="1" value="street">
> > 		<option id="2" value="court">
> > 		<option id="3" value="road">
> > 	</combo>
> > </combos>
> >
> > This works fine, i can load all of the objects into a LinkedHashMap but I
> > want to reuse the combo boxes witout having to clone objects.  I would
> > like
> > to tell the digester to load just one object based on an attribute in a
> > tag.
> > eg MyComboBoxClass colour = loadCombo("colour");
> >

Why can't you just call:

  MyComboBoxClass colour = (MyColour) linkedHashMap.get("colour");

It seems like a lot of extra effort to reparse the XML every single time.

> > I have read the article on the ibm website regarding using lucene
> > (http://www-106.ibm.com/developerworks/library/j-lucene) but I did not ant
> > to go to the trouble of building idexes on the hard drive.
> >
> > Thanks,
> >
> > Aaran
> >

Craig


Mime
View raw message