On Tuesday, July 29, 2003, at 02:02 AM, Craig R. McClanahan wrote:
On Mon, 28 Jul 2003, robert burrell donkin wrote:
Date: Mon, 28 Jul 2003 23:50:17 +0100 From: robert burrell donkin <[EMAIL PROTECTED]> Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]> To: Jakarta Commons Users List <[EMAIL PROTECTED]> 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.
+1
(though i suspect that the repeated xml parsing is an alternative to cloning the object in the hashmap.)
i've been thinking about this and wondering whether adding filtering to digester might be useful. SAX filters in the pipeline above digester is probably the most effective way to implement this kind of functionality but maybe there's a niche for simple filtering in the digester layer before the matches are processed.
maybe one day real pipelining would be cool but a simple filter which would suppress processing of certain elements based on the information similar to that contained in the begin signature in digester would be quick to implement and easy to use.
comments?
- robert
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
