commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Jakarta-commons Wiki] Update of "Digester/FAQ" by SimonKitching
Date Fri, 10 Feb 2006 05:07:24 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-commons Wiki" for change notification.

The following page has been changed by SimonKitching:

The comment on the change is:
Add entry about matching on attribute value

+ == How do I match elements based on attribute values? ==
+ Occasionally, people ask how they can fire a rule for an element based on the
+ value of an attribute, eg
+ {{{
+  <item value="enabled">
+ }}}
+ but not for
+ {{{
+  <item value="disabled">
+ }}}
+ There is no simple way to do this with Digester; the built-in rule-matching
+ engines only provide the ability to match on element name. There is no support
+ available for XPath expressions like "item[@value='enabled']".
+ It might be possible to create a custom "filtering" rule that has a child rule,
+ and fires that child rule only when the appropriate conditions are set. There
+ are no examples of such a solution, however.
+ A possible solution is to perform an XSLT transform to filter out or rename elements that
+ match certain conditions before using Digester to process the document. 
+ SAX "filters" may also be useful; see class org.xml.sax.XMLFilter in the standard java
+ javadocs. Transforming the name of matching elements should then allow rules to match
+ based on the element name only.
+ If you are aware of other solutions to this issue, please add that information here.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message