Apache Module mod_xml2

Available Languages:  en 

Description:Integrates libxml2 into Apache filtering
Status:Extension
Module Identifier:xml2_module
Source File:mod_xml2.c
Compatibility:Version 2.2 and later

Summary

mod_xml2 is a filter module that designed to be used by other modules. It implements a filter that runs the libxml2 parser on its input data and creates a stream of buckets holding xml nodes.


Topics

See also

top

XML Parsing

mod_xml2 implements the libxml2 parser in the node filter. This filter wraps all libml2 nodes into buckets of a custom bucket type named NODE. These buckets morph into heap buckets when their read function is called. This happens for example when they reach the network filter.

The filter is added to the output filter chain as usual:


    SetOutputFilter node
    

Doing the above has no effect, except for slight changes in whitespace and errors on invalid HTML or XML.

top

mod_xml2 API

mod_xml2 is best used with mod_xml2_extern.h. This provides a single optional function to load all API funtions as struct members.


    mod_xml2_t xml2;

    APR_OPTIONAL_FN_TYPE(xml2_load_fns) * xml2_load_fns =
        APR_RETRIEVE_OPTIONAL_FN(xml2_load_fns);

    xml2 = xml2_load_fns();
    if (!xml2.abort) {
        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p,
                      "Failed to retrieve API functions. " 
                      "Is mod_xml2 loaded?");
    }

    xml2.xpath_filter_init( ....

    

For details on the indiviual API functions see mod_xml2.h.

Apache2::ModXml2

Currently the easiest way to use mod_xml2 is through its perl wrapper. See the Apache2::ModXml2 documentation for details.

top

Available Languages:  en