1 16 package org.apache.cocoon.xml; 17 18 import org.apache.avalon.excalibur.pool.Recyclable; 19 import org.apache.avalon.framework.logger.AbstractLogEnabled; 20 import org.xml.sax.ContentHandler ; 21 import org.xml.sax.ext.LexicalHandler ; 22 import org.xml.sax.helpers.DefaultHandler ; 23 24 32 public abstract class AbstractXMLProducer extends AbstractLogEnabled 33 implements XMLProducer, Recyclable { 34 35 protected static final ContentHandler EMPTY_CONTENT_HANDLER = new DefaultHandler (); 36 37 38 protected XMLConsumer xmlConsumer; 39 40 41 protected ContentHandler contentHandler = EMPTY_CONTENT_HANDLER; 42 43 44 protected LexicalHandler lexicalHandler = DefaultLexicalHandler.NULL_HANDLER; 45 46 52 public void setConsumer(XMLConsumer consumer) { 53 this.xmlConsumer = consumer; 54 setContentHandler(consumer); 55 setLexicalHandler(consumer); 56 } 57 58 64 public void setContentHandler(ContentHandler handler) { 65 this.contentHandler = handler; 66 } 67 68 74 public void setLexicalHandler(LexicalHandler handler) { 75 this.lexicalHandler = handler; 76 } 77 78 82 public void recycle() { 83 this.xmlConsumer = null; 84 this.contentHandler = EMPTY_CONTENT_HANDLER; 85 this.lexicalHandler = DefaultLexicalHandler.NULL_HANDLER; 86 } 87 } 88 | Popular Tags |