XML::Compile::Schema 0.05 review

Download
by rbytes.net on

XML::Compile::Schema is a Perl module to compile a schema. INHERITANCE XML::Compile::Schema is a XML::Compile SYNOPSIS

License: Perl Artistic License
File size: 0K
Developer: Mark Overmeer
0 stars award from rbytes.net

XML::Compile::Schema is a Perl module to compile a schema.

INHERITANCE

XML::Compile::Schema
is a XML::Compile

SYNOPSIS

# preparation
my $parser = XML::LibXML->new;
my $tree = $parser->parse...(...);

my $schema = XML::Compile::Schema->new($tree);

my $schema = XML::Compile::Schema->new($xml_string);
my $read = $schema->compile(READER => 'mytype');
my $hash = $read->($xml);

my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $write = $schema->compile(WRITER => 'mytype');
my $xml = $write->($doc, $hash);
print $xml->toString;

This module collects knowledge about a schema. The most important method is compile() which can create XML file readers and writers based on the schema information and some selected type.

WARNING: The compiler is implemented in XML::Compile::Schema::Translate, which is NOT FINISHED. See that manual page about the specific behavior and its (current) limitations! Please help to find missing pieces and mistakes.

WARNING: the provided schema is not validated! In some cases, compile-time and run-time errors will be reported, but typically only in cases that the parser has no idea what to do with such a mistake. On the other hand, the processed data is validated: the output should follow the specs closely.

Two implementations use the translator, and more can be added later. Both get created with the compile() method.

XML Reader

The XML reader produces a hash from a XML::LibXML::Node tree, or an XML string. The values are checked and will be ignored if the value is not according to the specs.

XML Writer

The writer produces schema compliant XML, based on a hash. To get the data encoding correct, you are required to pass a document in which the XML nodes may get a place later.

Requirements:
Perl

XML::Compile::Schema 0.05 keywords