001 // XMLFilter.java - filter SAX2 events. 002 // http://www.saxproject.org 003 // Written by David Megginson 004 // NO WARRANTY! This class is in the Public Domain. 005 // $Id: XMLFilter.java,v 1.1 2004/12/23 22:38:42 mark Exp $ 006 007 package org.xml.sax; 008 009 010 /** 011 * Interface for an XML filter. 012 * 013 * <blockquote> 014 * <em>This module, both source code and documentation, is in the 015 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 016 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 017 * for further information. 018 * </blockquote> 019 * 020 * <p>An XML filter is like an XML reader, except that it obtains its 021 * events from another XML reader rather than a primary source like 022 * an XML document or database. Filters can modify a stream of 023 * events as they pass on to the final application.</p> 024 * 025 * <p>The XMLFilterImpl helper class provides a convenient base 026 * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver 027 * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler}, 028 * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler 029 * ErrorHandler} events automatically.</p> 030 * 031 * @since SAX 2.0 032 * @author David Megginson 033 * @version 2.0.1 (sax2r2) 034 * @see org.xml.sax.helpers.XMLFilterImpl 035 */ 036 public interface XMLFilter extends XMLReader 037 { 038 039 /** 040 * Set the parent reader. 041 * 042 * <p>This method allows the application to link the filter to 043 * a parent reader (which may be another filter). The argument 044 * may not be null.</p> 045 * 046 * @param parent The parent reader. 047 */ 048 public abstract void setParent (XMLReader parent); 049 050 051 /** 052 * Get the parent reader. 053 * 054 * <p>This method allows the application to query the parent 055 * reader (which may be another filter). It is generally a 056 * bad idea to perform any operations on the parent reader 057 * directly: they should all pass through this filter.</p> 058 * 059 * @return The parent filter, or null if none has been set. 060 */ 061 public abstract XMLReader getParent (); 062 063 } 064 065 // end of XMLFilter.java