001// XMLFilter.java - filter SAX2 events. 002// Written by David Megginson, sax@megginson.com 003// NO WARRANTY! This class is in the Public Domain. 004 005// $Id: XMLFilter.java,v 1.1 2001/03/05 21:40:06 jstrachan Exp $ 006 007 008package org.xml.sax; 009 010 011/** 012 * Interface for an XML filter. 013 * 014 * <blockquote> 015 * <em>This module, both source code and documentation, is in the 016 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 017 * </blockquote> 018 * 019 * <p>An XML filter is like an XML reader, except that it obtains its 020 * events from another XML reader rather than a primary source like 021 * an XML document or database. Filters can modify a stream of 022 * events as they pass on to the final application.</p> 023 * 024 * <p>The XMLFilterImpl helper class provides a convenient base 025 * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver 026 * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler}, 027 * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler 028 * ErrorHandler} events automatically.</p> 029 * 030 * @since SAX 2.0 031 * @author David Megginson, 032 * <a href="mailto:sax@megginson.com">sax@megginson.com</a> 033 * @version 2.0 034 * @see org.xml.sax.helpers.XMLFilterImpl 035 */ 036public 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