[jdom-interest] SAXOutputter

Bradley S. Huffman hip at cs.okstate.edu
Mon Apr 19 08:49:37 PDT 2004


Laurent Bihanic writes:

> Attached is a patch proposal that modifies SAXOutputter to :
> - make startDocument and endDocument protected final
> - add a new public method output(Content) to output a single Content node
> - add two new protected methods output(List/Content, boolean fireDocumentEven
> ts)
>
> 
> The last two methods support not firing start/endDocument events when 
> fireDocumentEvents is set to false. These methods are protected on purpose : 
> To use them, one needs to subclass SAXOutputter which allows to add the logic
>  
> to invoke startDocument and endDocument.
> 
> What do you think?

Still don't see what's so ugly about a wrapper.

Brad

import org.xml.sax.helpers.XMLFilterImpl;

public class ContentHandlerWrapper extends XMLFilterImpl {

    public ContentHandlerWrapper(ContentHandler handler) {
        setContentHandler(handler);
    }

    public void startDocument() throws SAXException {
        // Ignore
    }

    public void endDocument() throws SAXException {
        // Ignore
    }
}



More information about the jdom-interest mailing list