NAME
PYX::XMLNorm - Processing PYX data or file and do XML normalization.
SYNOPSIS
use PYX::XMLNorm;
my $obj = PYX::XMLNorm->new(%parameters);
$obj->parse($pyx, $out);
$obj->parse_file($input_file, $out);
$obj->parse_handler($input_file_handler, $out);
METHODS
new(%parameters)
my $obj = PYX::XMLNorm->new(%parameters);
Constructor.
flush_stack
Flush stack on finalization.
Default value is 0.
output_handler
Output handler.
Default value is \*STDOUT.
rules
XML normalization rules. Parameter is required. Format of rules is: Outer element => list of inner elements. e.g.
{ 'middle' => ['end'], },
Outer element can be '*'.
Default value is {}.
Returns instance of object.
parse($pyx[, $out])
$obj->parse($pyx, $out);
Parse PYX text or array of PYX text. If $out
not present, use 'output_handler'.
Returns undef.
parse_file($input_file[, $out])
$obj->parse_file($input_file, $out);
Parse file with PYX data. If $out
not present, use 'output_handler'.
Returns undef.
parse_handler($input_file_handler[, $out])
$obj->parse_handler($input_file_handler, $out);
Parse PYX handler. If $out
not present, use 'output_handler'.
Returns undef.
ERRORS
new():
Cannot exist XML normalization rules.
From Class::Utils::set_params():
Unknown parameter '%s'.
EXAMPLE
use strict;
use warnings;
use PYX::XMLNorm;
# Example data.
my $pyx = <<'END';
(begin
(middle
(end
-data
)middle
)begin
END
# Object.
my $obj = PYX::XMLNorm->new(
'rules' => {
'middle' => ['end'],
},
);
# Nomrmalize..
$obj->parse($pyx);
# Output:
# (begin
# (middle
# (end
# -data
# )end
# )middle
# )begin
DEPENDENCIES
Class::Utils, Error::Pure, PYX, PYX::Parser.
SEE ALSO
REPOSITORY
https://github.com/michal-josef-spacek/PYX-XMLNorm
AUTHOR
Michal Josef Špaček skim@cpan.org.
LICENSE AND COPYRIGHT
© 2011-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.05