![]() |
morphis | wax | ||||||||||||
![]() |
|||||||||||||
SAX Translator: OverviewThe SAX Translator provides translation on HTML and XML streams using one or more filters which act on XML SAX events. This type of translator is useful for scenarios like:
To use the SAX Translator you must tell Morphis you which
to translate using the
Notice how the translator itself may have multiple filters. Each filter may also be associated with multiple parameters. Filters perform the actual translation, and are chained together to perform complex translation. Morphis includes a built-in XSLT filter for performing XSLT translation, and custom SAX translator filters may be written to perform custom behavior. Each filter is given a name that defines how it will be processed. SAX Translators will only look at filters whose type are "translate". The general flow of the SAX Translator is as follows:
The "In-Stream" is the stream which originates from the Requestor. The parser parses the in-stream into SAX events. Each filter is responsible for performing SAX based translation, and handing off the results to the next filter. The final filter is responsible for converting the SAX events into an "Out-Stream" which is returned to the requesting device. Since each filter can be chained to another filter, it is possible to perform many different types of translations in one process. It's even possible to perform multiple XSLT translations in one process. The document obtained from the Requestor must first be parsed for SAX events. Morphis provides an HTML parser as well as an XML parser to perform this work. Morphis is usually smart enough to determine which parser to use. If, however, you suspect that Morphis is trying to parse an HTML document as XML (or, less likely, vice versa), you can inform Morphis to use the right parser with the parser processing parameter:
The following snippet of dispatch.xml illustrates this:
Further reading: |
|||||||||||||
![]() |