[jdom-interest] Need help (filters) on SAXHandler ...

Jon Baer jonbaer at digitalanywhere.com
Thu Mar 7 09:26:10 PST 2002


Here is my current problem (after going through the archives and looking
at FilterList and Filter subject, I realize it hasn't been discussed).

I am interested in creating a Builder that does not return a JDOM
Document.  Strange but true.  Basically what I want to do is create an
Event/Listener with Elements that doesn't really return anything.
Before I dive in after looking at SAXHandler code I was wondering if
there was a normal or more easy way of doing this.  I saw that the
FilterList and Filtering in general mostly pertained to a JDOM Document
model after it was built. For this reason Im not really interested in
XPath either..

The thing is I don't really want to use SAX either because Im really
after the JDOM Element object for other purposes.

Does this make sense:

NullBuilder b = new NullBuilder();
b.setElementListener("foo", this);
b.setElementListener("bar", this);
b.build();

public void elementReceived(Element e) {
    if (e.getName().equals("foo")) {}
    if (e.getName().equals("bar")) {}
}

The easiest step in seeming to do this is to rework stack.push(element);
with some logic in SAXHandler being used.  Correct?  Any ideas?  The
thing I want to do is simply wrap up the Element once everything has
been received send it to the listerner, do it's business, and get rid of
it.

- Jon






More information about the jdom-interest mailing list