The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::AxKit::Provider::DOM - Base Class For Parsed XML Providers

SYNOPSIS

use base Apache::AxKit::Provider::DOM;

DESCRIPTION

Apache::AxKit::Provider::DOM allows to pass a parsed XML document directly to AxKit. It can be used as a base class for application providers, that create XML documents in memory. So Apache::AxKit::Provider::DOM provides an easy way to write application providers for AxKit 1.6.

Commonly an inheritated class only implements the provider function 'init()' and if required the provider function 'get_styles()'.

To make the provider work properly a class must provide the document tree in the special provider key 'dom_tree'.

A sample DOM provider could be:

package MyDomProvider;

use vars (@INC);
use XML::LibXML;
use Apache::AxKit::Provider::DOM;
@INC = ('Apache::AxKit::Provider::DOM');

sub init {
    my $class = shift;
    $class->{dom_tree} = XML::LibXML->new;
    $class->{dom_tree}->setDocumentElement(
       $class->{dom_tree}->createElement( 'foo' );
    );
}

1;

This sample provider would cause AxKit to use the default style as provided in the style map of the server configuration.

If a provider based on Apache::AxKit::Provider::DOM and does not set the 'dom_tree' key as shown in the example AxKit will not process this ressource.

SEE ALSO

AxKit, Apache::AxKit::Provider