xml: Port SAX 2.0.
[nit.git] / lib / sax / xml_filter.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
9 # another product.
10
11 # Interface for an XML filter.
12 module sax::xml_filter
13
14 import xml_reader
15
16 # Interface for an XML filter.
17 #
18 # An XML filter is like an XML reader, except that it obtains its
19 # events from another XML reader rather than a primary source like
20 # an XML document or database. Filters can modify a stream of
21 # events as they pass on to the final application.
22 #
23 # The `XMLFilterImpl` helper class provides a convenient base
24 # for creating SAX2 filters, by passing on all `EntityResolver`,
25 # `DTDHandler`, `ContentHandler` and `ErrorHandler` events automatically.
26 #
27 # Note: The original documentation comes from [SAX 2.0](http://www.saxproject.org).
28 #
29 # SEE: `sax::helpers::XMLFilterImpl`
30 interface XMLFilter super XMLReader
31
32 # Set the parent reader.
33 #
34 # This method allows the application to link the filter to
35 # a parent reader (which may be another filter).
36 fun parent=(parent: nullable XMLReader) is abstract
37
38 # Get the parent reader.
39 #
40 # This method allows the application to query the parent
41 # reader (which may be another filter). It is generally a
42 # bad idea to perform any operations on the parent reader
43 # directly: they should all pass through this filter.
44 #
45 # Return null if no parent has been set.
46 fun parent: nullable XMLReader is abstract
47 end