[jdom-interest] Additional functionality for class org.jdom.filter.ElementFilter?

Michael Kordt kordt at uni-wuppertal.de
Mon Jul 4 08:47:21 PDT 2005


one question regarding element filters. Is there any means to retrieve the 
element name (and, consequently, the namespace) of an 
org.jdom.filter.ElementFilter instance later on after object creation?

The background: I have written a method that tries to look up an element 
matching a given name as well as a specified (unique) value of a specified 
attribute from a given starting point (e. g. root element). For this purpose, I 
have extended the ElementFilter class to allow this "advanced" filtering. If the 
specified element does not exist, an exception is generated - and in order to 
provide detailed information on what went wrong (to facilitate trouble 
shooting), I want to list the criteria for filtering within the error message of 
that exception.

As far as I have studied the JDOM API docs, I would say that unfortunately I 
will not be able to retrieve the element name (and namespace) to be matched from 
ElementFilter (i. e. my specialized filter's superclass) unless I store it once 
more in my derived filter class which provides appropriate getters...

So if these possibilities of retrieving filtering criteria really do not exist 
in the current JDOM release, I'd like to suggest adding them in the next release 
(probably JDOM 1.1?) - this would be a small but convenient enhancement to an 
already very comfortable and easy-to-use API for processing XML documents.

Michael Kordt

More information about the jdom-interest mailing list