5.6. Filters

Filters describe the transformation of serialized data to a unified element sequence of hierarchical structured data and to document meta data and back. The application does not care about data formats as long as there exists a filter providing the unified form of data. This unified data format is represented as iterator visiting the nodes of the document tree and plus a contract to level out language differences. Additioally each document type has some metadata defined. A filter interprets all meta data it understands (his) and uses them for output.

This chapter describes how filters for different data formats are linked to the logic tier. For each data format supported by Wolframe one or more filter type is introduced.

After reading this chapter you should be able to handle different document formats and encodings in the logic tier of Wolframe. You will know how to add programs for scriptable filters like XSLT.

Be aware that you have to configure a data filter of the logic tier in Wolframe before using it. Each chapter introducing a filter type will have a section that describes how the server configuration of Wolframe has to be extended for its availability.

5.6.1. XML Filter

Introduction

You can use XML for data filters in the logic tier of Wolframe. There are the following variants of XML filters available:

Character set encodings

The libxml2 and the textwolf filter support at least the following character set encodings. For character set encodings that are not in the list, please ask the Wolframe team.

  • UTF-8 or

  • UTF-16LE or

  • UTF-16 (UTF-16BE) or

  • UTF-32LE (UCS-4LE) but only with textwolf or

  • UTF-32 (UTF-32BE or UCS-4BE) or

  • ISO 8859 (code pages '1' to '9')

Configuration

For using an XML filter based libxml2, you have to load the modules mod_filter_libxml2 and mod_doctype_xml. For this you add the two following lines to the LoadModules section of your Wolframe configuration:

		
    Module mod_doctype_xml
    Module mod_filter_libxml2


		

For using an XML filter based textwolf, you have to load the modules mod_filter_textwolf and mod_doctype_xml. For this you add the following two lines to the LoadModules section of your Wolframe configuration:

		
    Module mod_doctype_xml
    Module mod_filter_textwolf

		

5.6.2. JSON filter

Introduction

You can use JSON for data filters in the logic tier of Wolframe. The standard JSON filter of Wolframe is called cjson and based on the library cJSON (http://sourceforge.net/projects/cjson) from Dave Gamble.

Character set encodings

Without explicitly specified, the cjson filter support the following character set encodings. For character set encodings that are not in the list, please ask the Wolframe team.

  • UTF-8 or

  • UTF-16LE or

  • UTF-16 (UTF-16BE) or

  • UTF-32LE (UCS-4LE) or

  • UTF-32 (UTF-32BE or UCS-4BE) or

Configuration

For using the JSON filter based cJSON, you have to load the module 'mod_filter_cjson'. For this you add the following line to the LoadModules section of your Wolframe configuration:

		
    Module mod_doctype_json
    Module mod_filter_cjson

		

5.6.3. XSLT Filter

Introduction

You can use XSLT for data filters in the logic tier of Wolframe. The XSLT filter of Wolframe for is based on libxml2 (http://www.xmlsoft.org).

Character set encodings

Without explicitly specified, the XSLT filter support the following character set encodings. For character set encodings that are not in the list, please ask the Wolframe team.

  • UTF-8 or

  • UTF-16LE or

  • UTF-16 (UTF-16BE) or

  • UTF-32LE (UCS-4LE) or

  • UTF-32 (UTF-32BE or UCS-4BE) or

Configuration

For using an XSLT filter based libxml2, you have to load the modules mod_filter_libxml2 and mod_doctype_xml. For this you add the following 2 lines to the LoadModules section of your Wolframe configuration:

		
    Module mod_doctype_xml
    Module mod_filter_libxml2


		

You also have to add the program of the XSLT filter into the Processor section of the configuration. The name of the filter is the filename of the XSLT filter program without path and extension. In our example the filter would be named invoice_ISOxxxx:

	
    Program invoice_ISOxxxx.xslt