XML Namespace API

The XML Namespace API enables markup to be processed at the server (or proxy) according to namespace. Thus, for example, formats such as XHTML or SVG to be delivered to the user may be mixed with processing instructions such as SQL queries, higher-level structure and metadata (e.g. mod_annot), processing instructions such as SSI or ESI, and application-specific markup such as that used by Microsoft Office.

The Basic API

The basic approach is that any module may register itself as a handler for a namespace by implementing a struct xmlns and registering it as a handler for xmlns:

	#include "xmlns.h"

	  static const char* MYNAMESPACE = "http://example.com/my-namespace#" ;

	  static xmlns my_namespace = {
	  } ;
	  ap_register_provider(pool, "xmlns", MYNAMESPACE, version, &my_namespace) ;

The xmlns struct comprises a subset of SAX2 callbacks, which will be called at every event in the namespace we registered for. In addition, a namespace handler may register to process comments: this is an extension designed for the benefit of hybrid namespace/comment processors such as ESI, and also enables SSI to be implemented easily both as a namespace and a comment processor, to enable SSI and XML processing in a single parse.


The API is documented in xmlns.h. This is defined as providing both source and binary compatibility between any parser that implements/consumes the API and any Namespace module that implements a provider for it. A namespace module MUST NOT rely on implementation details other than those exposed in the API.


Full details of my parsers and namespace applications are at WebÞing.


There are currently two filter modules that implement the API: mod_xmlns is a minimal XMLNS parser, and mod_publisher is a universal markup manipulation filter. Both are available from WebÞing.

Namespace Modules

Several namespace application modules are available from WebÞing.