NAME
Petal::Canonicalizer::XML - Builds an XML canonical Petal file
DESCRIPTION
This modules mainly implements the XML::Parser 'Stream' interface. It receives XML events and builds Petal canonical data, i.e.
<foo petal:if="bar">Hello</foo>
Might be canonicalized to something like
<?petal:if name="bar"?>
<foo>Hello</foo>
<?petal:end?>
$class->process ($parser, $data_ref);
returns undef if $parser object (i.e. a Petal::Parser::XML object) could not parse the data which $data_ref pointed to.
returns a reference to the canonicalized string otherwise.
StartTag
Called for every start tag with a second parameter of the element type. It will check for special PETAL attributes like petal:if, petal:loop, etc... and rewrite the start tag into @Result accordingly.
For example
<foo petal:if="blah">
Is rewritten
<?petal:if name="blah"?><foo>...
EndTag
Called for every end tag with a second parameter of the element type. It will check in the @NodeStack to see if this end-tag also needs to close some 'condition' or 'repeat' statements, i.e.
</li>
Could be rewritten
</li><?petal:end?>
If the starting LI used a loop, i.e. <li petal:loop="element list">
Text
Called just before start or end tags. Turns all variables such as $foo:bar into <?petal var name=":foo bar"?>
AUTHOR
Jean-Michel Hiver <jhiver@mkdoc.com>
This module is redistributed under the same license as Perl itself.