[jdom-interest] using XMLFilter

Bruce Ritchie bruce.ritchie at maclaren.com
Fri Jul 13 10:01:25 PDT 2001


> I would like to wirte a simple filter that removes som Tags form the input
> file. I don't understand how to set up the filter.
> Something is missing because I get an empty document.
> The jdom-b7 examples have not been helpfull to me.
> I think I need to set a parent XMLReader when constructing the
> XMLFilterImpl
> but I have no idea where to find a parent.

Something isn't missing, the SAXBuilder class is broken. Take the


        // Install optional filter
        if (saxXMLFilter != null) {
            // Connect filter chain to parser
            XMLFilter root = saxXMLFilter;
            while (root.getParent() instanceof XMLFilter) {
                root = (XMLFilter)root.getParent();
            }
            root.setParent(parser);

            // Read from filter
            parser = saxXMLFilter;
        }

from configureParser and stick it at the end of createParser(just before the
return parser; statement. Attempted change to an object reference (line 445,
parser = saxXMLFilter) is the root cause as discovered by 'ahsene
[ab at ablog.com]' on the jive mailing list.


Regards,

Bruce Ritchie




More information about the jdom-interest mailing list