Content Pipeline Guide > Content Pipelines > Creating Filters and Filter Adapters > Default Java Classes
  
Default Java Classes
Arbortext Editor and Arbortext Publishing Engine provide two classes, DefaultSAXFilter and DefaultAdapter, for developing filters. These files help minimize the amount of code that needs to be written.
The DefaultSAXFilter class implements the SAXFilter interface, which is a convenience mix-in interface that extends the seven SAX2 interfaces and the FilterControl interface. The DefaultSAXFilter echoes the SAX events it receives to its outputs.
For example, if you want to write a simple filter that counts the number of characters in an XML document, you would subclass the DefaultSAXFilter class and override the characters method to keep a tally of the number of characters.
You can use the DefaultAdapter class with any filter that implements the SAXFilter interface. Therefore, any class that is a subclass of DefaultSAXFilter can be used in the pipeline with an instance of the DefaultAdapter class. Refer to the grep Filter Example for an example of how to implement the DefaultAdapter class in a filter.
If an object exists that implements one or more of the SAX2 interfaces, you can write a filter adapter. This is helpful in situations in which the object is an off-the-shelf component that cannot be modified to implement Arbortext-specific interfaces.