mod_publisher: Extensions API

mod_publisher implements two APIs for extension:

  1. The SAX/SAX2 API is exposed before parsing for other modules to set their own handlers - for example to process Entities or Notations.
  2. The XML Namespace API is fully supported. Namespace modules developed for mod_xmlns using the API are now both source and binary-compatible with mod_publisher.


A module may hook a function to set up your own SAX handlers before starting to parse the document. This is currently a very simple API, and likely to be subject to change. Your module may implement a function taking the form
void my_sax_init_func(request_rec* r, xmlSAXHandlerPtr sax)
Your function now has the opportunity to set its own handlers in the SAX Handler struct. Your function is hooked in using
apx_hook_sax_init(pool, my_sax_init_func)
and will then be called for every request where mod_publisher is active. It is the responsibility of your function to inspect the request_rec and determine what (if anything) it should do with the SAX handler.

The API is prototyped and documented in mod_publisher_sax.h.

XML Namespace API

Please see mod_xmlns. mod_publisher implements the same namespace API and supports the same namespace modules.

Differences with mod_xmlns

mod_publisher offers some significant advantages over mod_xmlns, including its builtin support for macros, rewrites and DTDs. Less obviously, it accepts a much wider range of inputs through (dynamic) selection of parse mode, and offers much better internationalisation support as described under parser details.



If namespaces are enabled, mod_publisher will parse in SAX2 mode; otherwise it will use the old SAX. The parser is libxml2 in either case. Please see the xmlbench benchmarks for the performance implications of this.


Namespace processing has precedence over other processing in mod_publisher.