On Tue, 2003-10-21 at 10:57, Craig R. McClanahan wrote:
But you could certainly supply your own Rule (no trailing "s") implementation whose begin() method checked the Attributes that are passed to see which (if any) xml:lang attribute was set.
Craig
Hmm .. so
digester.addRule ( "obj/attr",
new LangFilterRule("en",
new CallMethodRule(....));
digester.addRule ( "obj/attr",
new LangFilterRule("en",
new CallParamRule(....));
digester.addRule ( "obj/attr",
new LangFilterRule("fr",
new CallMethodRule(....));
digester.addRule ( "obj/attr",
new LangFilterRule("fr",
new CallParamRule(....));
Looks pretty cumbersome to me. Doable, but cumbersome.
Depends how many language-sensitive rules there are, I guess.
It would certainly be nicer to say: digester.setLanguage("fr") or digester.getRules().setLanguage("fr")
Hmm... maybe the solution is instead to write a SAX filter that filters out any elements with undesirable lang settings?????
I'd be -1 on trying to make anything in the generic rules dependent *solely* on xml:lang, instead of being able to be dependent on some other arbitrary attribute.
If it were up to me, I wouldn't build conditionality into the Digester rules in the first place -- I'd build it into the object that receives a completed object and ignores it if it doesn't want that instance. But that's just me ...
CraigRicky: note that Digester implements org.xml.sax.ContentHandler, ie you can create a SAX parser object yourself and set a Digester instance as the content handler for that parser (this is all Digester's parse method does internally). So you could: (a) create a SAXParser instance (b) create an org.xml.sax.XMLFilter instance which removes all undesired elements and passes the remainder to the Digester instance.
Hope this helps,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
