CAM::XML 1.14 review
DownloadCAM::XML is an encapsulation of a simple XML data structure. SYNOPSIS my $pollTag = CAM::XML->new('poll'); foreach my
|
|
CAM::XML is an encapsulation of a simple XML data structure.
SYNOPSIS
my $pollTag = CAM::XML->new('poll');
foreach my $q (@questions) {
my $questionTag = CAM::XML->new('question');
$questionTag->add(-text => $q->{text});
my $choicesTag = CAM::XML->new('choices');
foreach my $c (@{$q->{choices}}) {
my $choiceTag = CAM::XML->new('choice');
$choiceTag->setAttributes('value', $c->{value});
$choiceTag->add(-text => $c->{text});
$choicesTag->add($choiceTag);
}
$questionTag->add($choicesTag);
$pollTag->add($questionTag);
}
print CAM::XML->header();
print $pollTag->toString();
This module reads and writes XML into a simple object model. It is optimized for ease of creating code that interacts with XML.
This module is not as powerful or as standards-compliant as say XML::LibXML, XML::SAX, XML::DOM, etc, but it's darn easy to use. I recommend it to people who want to just read/write a quick but valid XML file and don't want to bother with the bigger modules.
In our experience, this module is actually easier to use than XML::Simple because the latter makes some assumptions about XML structure that prevents it from handling all XML files well. YMMV.
However, one exception to the simplicity claimed above is our implementation of a subset of XPath. That's not very simple. Sorry.
Requirements:
Perl
CAM::XML 1.14 search tags