The SAX Filter Framework enables the creation of robust, complex XML processing applications using the SAX API.

Loading SAX Pipelines

Using a pipeline configuration file to create a usable SAX construct consists of three steps.
  1. Use the {@link com.puck.saxfilter.PipelineBuilder} to load the pipeline configuration into a {@link com.puck.saxfilter.PipelineConfig} object.
  2. Create a {@link com.puck.saxfilter.PipelineContext} object and load it with the runtime parameters for the pipeline.
  3. Call {@link com.puck.saxfilter.PipelineConfig#instantiate(com.puck.saxfilter.PipelineContext)} to create a configured {@link com.puck.saxfilter.FilterChain}.
The resulting FilterChain object can be used in one of two ways.
  1. The filter geometry can be exercised in a standalone way by calling {@link com.puck.saxfilter.FilterChain#execute()}.
  2. Because the FilterChain implements the org.xml.sax.XMLFilter interface, the chain can be plugged into other SAX-based applications.
PipelineConfig cfg = PipelineBuilder.buildPipeline(pipelineFile);
PipelineContext cxt = new PipelineContext();
cxt.addParameter("foo", "bar");
FilterChain fc = cfg.instantiate(cxt);
fc.execute();

Developing Filters

In theory, any Java class implementing the org.xml.sax.SAXFilter interface could be used as a filter in a pipeline. However, in practice, it is preferable for custom filters to implement the {@link com.puck.saxfilter.SAXFilter} interface, which provides some additional methods ensuring full coverage of the various SAX interfaces. The framework provides a number of base classes that can be used to simplify new filter development.