![]() |
morphis | wax | |
![]() |
||
SAX Translator: Writing Custom SAX FiltersCustom SAX Translator Filters are useful for performing complex translation based on SAX Events outside of the context of an XSLT Translation. For instance, you can write a SAX Filter to append a string to the end of every "href" attribute it finds. Or, you can build a SAX Filter that extracts all character data and converts it to another language. Understanding how a SAX Filter works should be easy if you
understand how XML SAX events, and the SAX 1 A Custom SAX Filter must extend org.morphis.translator.TranslatorFilter.
A TranslatorFilter contains a handle to a delegate
You can also use the Custom SAX Filters are instantiated in an object pool, and the lifecycle of a filter is only one request. Therefore, the constructor to a custom SAX Filter must be public, and should be empty. If you need to set up state, you should implement the setState() method which is called once before processing occurs. You should also implement reset(), which is called once after processing completes. The last filter in a chain is a special case of SAX filter.
The last filter is responsible for turning SAX events into an output stream.
Therefore, if your filter is the last filter in a SAXTranslator
process, you must implement the
|
||
![]() |