1. // XMLFilter.java - filter SAX2 events.
  2. // Written by David Megginson, sax@megginson.com
  3. // NO WARRANTY! This class is in the Public Domain.
  4. // $Id: XMLFilter.java,v 1.1 2001/05/20 03:12:56 curcuru Exp $
  5. package org.xml.sax;
  6. /**
  7. * Interface for an XML filter.
  8. *
  9. * <blockquote>
  10. * <em>This module, both source code and documentation, is in the
  11. * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  12. * </blockquote>
  13. *
  14. * <p>An XML filter is like an XML reader, except that it obtains its
  15. * events from another XML reader rather than a primary source like
  16. * an XML document or database. Filters can modify a stream of
  17. * events as they pass on to the final application.</p>
  18. *
  19. * <p>The XMLFilterImpl helper class provides a convenient base
  20. * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
  21. * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
  22. * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
  23. * ErrorHandler} events automatically.</p>
  24. *
  25. * @since SAX 2.0
  26. * @author David Megginson,
  27. * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
  28. * @version 2.0r2pre
  29. * @see org.xml.sax.helpers.XMLFilterImpl
  30. */
  31. public interface XMLFilter extends XMLReader
  32. {
  33. /**
  34. * Set the parent reader.
  35. *
  36. * <p>This method allows the application to link the filter to
  37. * a parent reader (which may be another filter). The argument
  38. * may not be null.</p>
  39. *
  40. * @param parent The parent reader.
  41. */
  42. public abstract void setParent (XMLReader parent);
  43. /**
  44. * Get the parent reader.
  45. *
  46. * <p>This method allows the application to query the parent
  47. * reader (which may be another filter). It is generally a
  48. * bad idea to perform any operations on the parent reader
  49. * directly: they should all pass through this filter.</p>
  50. *
  51. * @return The parent filter, or null if none has been set.
  52. */
  53. public abstract XMLReader getParent ();
  54. }
  55. // end of XMLFilter.java