Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

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

Michael Kordt

2005-07-04


Hello,

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
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.