XML::PatAct::ToObjects 0.08 review

Download
by rbytes.net on

XML::PatAct::ToObjects is an action module for creating Perl objects. SYNOPSIS use XML::PatAct::ToObjects; my $patterns =

License: Perl Artistic License
File size: 311K
Developer: Ken MacLeod
0 stars award from rbytes.net

XML::PatAct::ToObjects is an action module for creating Perl objects.

SYNOPSIS

use XML::PatAct::ToObjects;

my $patterns = [ PATTERN => [ OPTIONS ],
PATTERN => "PERL-CODE",
... ];

my $matcher = XML::PatAct::ToObjects->new( Patterns => $patterns,
Matcher => $matcher,
CopyId => 1,
CopyAttributes => 1 );

XML::PatAct::ToObjects is a PerlSAX handler for applying pattern-action lists to XML parses or trees. XML::PatAct::ToObjects creates Perl objects of the types and contents of the action items you define.

New XML::PatAct::ToObject instances are creating by calling `new()'. Parameters can be passed as a list of key, value pairs or a hash. `new()' requires the Patterns and Matcher parameters, the rest are optional:

Patterns
The pattern-action list to apply.

Matcher
An instance of the pattern or query matching module.

CopyId
Causes the `ID' attribute, if any, in a source XML element to be copied to an `ID' attribute in newly created objects. Note that IDs may be lost of no pattern matches that element or an object is not created (-make) for that element.

CopyAttributes
Causes all attributes of the element to be copied to the newly created objects.

Each action can either be a list of options defined below or a string containing a fragment of Perl code. If the action is a string of Perl code then simple then some simple substitutions are made as described further below.

Requirements:
Perl

XML::PatAct::ToObjects 0.08 keywords