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

XML::Compile - Compilation based XML processing

SYNOPSIS

 # See XML::Compile::Schema

DESCRIPTION

Many applications which process data-centric XML do that based on a nice specification, expressed in an XML Schema. XML::Compile reads and writes XML data with the help of such schema's. On the Perl side, it uses a tree of nested hashes with the same structure.

Where other Perl modules, like SOAP::WSDL help you using these schema's (often with a lot of run-time (XPath) searches), this module takes a different approach: in stead of run-time processing of the specification, it will first compile the expected structure into real Perl, and then use that to process the data.

There are many perl modules with the same as this one: translate between XML and nested hashes. However, there are a few serious differences: because the schema is used here, we make sure we only handle correct data. Data-types are formatted and processed correctly; for instance, integer does accept huge values (at least 18 digits) as the specification prescribes. Also more complex data-types like list, union, and substitutionGroup (unions on complex type level) are supported, which is rarely the case in other modules.

METHODS

Constructors

These constructors are base class methods, and therefore not directly accessed.

$obj->new(TOP, OPTIONS)

    The TOP is a XML::LibXML::Document (a direct result from parsing activities) or a XML::LibXML::Node (a sub-tree). In any case, a product of the XML::LibXML module (based on libxml2).

    If you have compiled/collected all the information you need, then simply terminate the compiler object: that will clean-up the XML::LibXML objects.

Accessors

$obj->top

    Returns the XML::LibXML object tree which needs to be compiled.

Filters

$obj->walkTree(NODE, CODE)

    Walks the whole tree from NODE downwards, calling the CODE reference for each NODE found. When the routine returns false, the child nodes will be skipped.

Compilers

REFERENCES

See the XML::Compile website at http://perl.overmeer.net/xml-compile/ for more details.

COPYRIGHTS

Module version 0.05. Written by Mark Overmeer (mark@overmeer.net). See the ChangeLog for other contributors.

Copyright (c) 2006 by the author(s). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.