XML::TiePYX 0.05 review
DownloadXML::TiePYX is a Perl module to read or write XML data in PYX format via tied filehandle SYNOPSIS use XML::TiePYX; tie *
|
|
XML::TiePYX is a Perl module to read or write XML data in PYX format via tied filehandle
SYNOPSIS
use XML::TiePYX;
tie *XML,'XML::TiePYX','file.xml'
open IN,'file.xml' or die $!;
tie *XML,'XML::TiePYX',*IN,Condense=>0;
my $text='< tag xmlns="http://www.omsdev.com" >text< /tag >';
tie *XML,'XML::TiePYX',$text,Namespaces=>1;
tie *XML,'XML::TiePYX',*STDOUT;
print XML "(startn","-Hello, world!n",")startn";
XML::TiePYX lets you use a tied filehandle to read from or write to an XML file or string. PYX is a line-oriented, parsed representation of XML developed by Sean McGrath (http://www.pyxie.org). Each line corresponds to one "event" in the XML, with the first character indicating the type of event:
(
The start of an element; the rest of the line is its name.
A
An attribute; the rest of the line is the attribute's name, a space, and its value.
)
The end of an element; the rest of the line is its name.
-
Literal text (characters). The rest of the line is the text.
?
A processing instruction. The rest of the line is the instruction's target, a space, and the instruction's value.
Newlines in attribute values, text, and processing instruction values are represented as the literal sequence 'n' (that is, a backslash followed by an 'n'). By default, consecutive runs of characters are always gathered into a single text event when reading, but this behavior can be disabled. Comments are *not* available through PYX.
Just as SAX is an API well suited to "push"-mode XML parsing, PYX is well- suited to "pull"-mode parsing where you want to capture the state of the parse through your program's flow of code rather than through a bunch of state variables. This module uses incremental parsing to avoid the need to buffer up large numbers of events.
This module implements an (unofficial) extension to the PYX format to allow namespace processing. If namespaces are enabled, an element or attribute name will be prefixed by its namespace URI (*NOT* any namespace prefix used in the document) enclosed in curly braces. A name with no namespace will be prefixed with {}. At the present time, this module does not implement namespace processing in output mode; attempting to write '(', ')', or 'A' lines that contain a namespace URI in curly braces will merely result in generating ill-formed element or attribute names.
Requirements:
Perl
XML::TiePYX 0.05 search tags