mod_xmlns

mod_xmlns adds XML Namespace support to Apache, and may form the basis of XML-driven publishing systems. It runs as an output filter, so it works automatically with any content generator.

Like mod_so, it doesn't directly do anything useful. It serves to implement a LoadNamespace configuration directive, analagous to the standard LoadFile and LoadModule directives implemented by mod_so. It provides a simple API for namespace processors.

This module is at a pre-release stage, and is not yet recommended for use in an operational server.

Example

A very simple example namespace processor is provided for XHTML, acting on any elements in namespace http://www.w3.org/1999/xhtml:

Purpose

This XHTML handler serves to ensure XHTML is fully compliant with Appendix C, and can be served to current and legacy Web browsers as text/html. This could be used as an output filter for XML-based publishing systems that don't explicitly support Appendix C compatibility.

Implementation


xmlns xmlns_xhtml10 = {
	"http://www.w3.org/1999/xhtml" ,	/* Namespace			*/
	hstart ,				/* StartElement Handler		*/
	hend ,					/* EndElement Handler		*/
	NULL ,					/* StartNamespace Handler	*/
	NULL ,					/* EndNamespace Handler		*/
	NULL					/* private			*/
} ;

together with implementations of the non-null handlers defined. The analogy with Apache modules should be clear!

Configuration

The following three directives will ensure you can send .xhtml files as text/html without breaking in browsers:

LoadModule xmlns_module /usr/local/apache/modules/mod_xmlns.so
Standard command to load the module, thereby enabling LoadNamespace.
LoadNamespace xmlns_xhtml10 /usr/local/apache/modules/xhtml10.so
Load the XHTML 1.0 processor we just defined.
AddOutputFilter xmlns .xhtml
Turn on namespace processing for .xhtml files.

Applications

Some examples of the kind of applications enabled by mod_xmlns include:

Edge Side Includes

A processor for namespace http://www.edge-delivery.org/esi/1.0 implements the ESI Language Specification 1.0. This is not complete, but the basics are working. An ESI 1.0 Parser is available here.

Google API

Planned when I can find some time.

JSP 2.0

I don't know if this will work, but since JSP 2.0 is defined as an XML namespace, it should in principle be possible. If so, it should be much faster than "traditional" JSP.

Implementing a Namespace

Coming soon

Limitations

mod_xmlns is a minimalist SAX parser, and has no support for DTDs and external entities, nor does it offer much scope for sanity checks on markup being processed. A richer companion module mod_pubisher_xml is in development.

Availability

mod_xmlns.c source code, the mod_xmlns.h header file for namespace implementations and the xhtml10.c XHTML implementation are available under the GNU General Public License (GPL).

Please contact the developer regarding support for other namespaces.