XML::EasyOBJ 1.12 review

Download
by rbytes.net on

XML::EasyOBJ is an easy XML object navigation. SYNOPSIS # open exisiting file my $doc = new XML::EasyOBJ('my_xml_document.xm

License: Perl Artistic License
File size: 25K
Developer: Robert Hanson
0 stars award from rbytes.net

XML::EasyOBJ is an easy XML object navigation.

SYNOPSIS

# open exisiting file
my $doc = new XML::EasyOBJ('my_xml_document.xml');
my $doc = new XML::EasyOBJ(-type => 'file', -param => 'my_xml_document.xml');

# create object from XML string
my $doc = new XML::EasyOBJ(-type => 'string', -param => $xml_source);

# create new file
my $doc = new XML::EasyOBJ(-type => 'new', -param => 'root_tag');

# read from document
my $text = $doc->some_element($index)->getString;
my $attr = $doc->some_element($index)->getAttr('foo');
my $element = $doc->some_element($index);
my @elements = $doc->some_element;

# first "some_element" element
my $elements = $doc->some_element;
# list of "some_element" elements
my @elements = $doc->some_element;

# write to document
$doc->an_element->setString('some string')
$doc->an_element->addString('some string')
$doc->an_element->setAttr('attrname', 'val')
$doc->an_element->setAttr('attr1' => 'val', 'attr2' => 'val2')

# access elements with non-name chars and the underlying DOM
my $element = $doc->getElement('foo-bar')->getElement('bar-none');
my $dom = $doc->foobar->getDomObj;

# get elements without specifying the element name
my @elements = $doc->getElement();
my $sixth_element = $doc->getElement('', 5);

# remove elements/attrs
$doc->remElement('tagname', $index);
$doc->tag_name->remAttr($attr);

# remap builtin methods
$doc->remapMethod('getString', 's');
my $text = $doc->some_element->s;

I wrote XML::EasyOBJ a couple of years ago because it seemed to me that the DOM wasn't very "perlish" and the DOM is difficult for us mere mortals that don't use it on a regular basis. As I only need to process XML on an occasionally I wanted an easy way to do what I needed to do without having to refer back to DOM documentation each time.

A quick fact list about XML::EasyOBJ:

* Runs on top of XML::DOM
* Allows access to the DOM as needed
* Simple routines to reading and writing elements/attributes

Requirements:
Perl
XML::DOM

XML::EasyOBJ 1.12 search tags