XML::DOM::BagOfTricks 0.05 review

Download
by rbytes.net on

XML::DOM::BagOfTricks is a convenient XML DOM. SYNOPSIS use XML::DOM::BagOfTricks; # get the XML document and root eleme

License: Perl Artistic License
File size: 5K
Developer: Aaron Trevena
0 stars award from rbytes.net

XML::DOM::BagOfTricks is a convenient XML DOM.

SYNOPSIS

use XML::DOM::BagOfTricks;

# get the XML document and root element
my ($doc,$root) = createDocument('Foo');

# or

# get the XML document with xmlns and version attributes specified
my $doc = createDocument({name=>'Foo', xmlns=>'http://www.other.org/namespace', version=>1.3});

# get a text element like Bar
my $node = createTextElement($doc,'Foo','Bar');

# get an element like
my $node = createElement($doc,'Foo','isBar'=>0, 'isFoo'=>1);

# get a nice element with attributes that contains a text node Bar
my $foo_elem = createElementwithText($DOMDocument,'Foo','Bar',isFoo=>1,isBar=>0);

# add attributes to a node
addAttributes($node,foo=>'true',bar=>32);

# add text to a node
addText($node,'This is some text');

# add more elements to a node
addElements($node,$another_node,$yet_another_node);

# adds two text nodes to a node
addTextElements($node,Foo=>'some text',Bar=>'some more text');

# creates new XML:DOM::Elements and adds them to $node
addElements($node,{ name=>'Foo', xlink=> 'cid:..' },{ .. });

# extracts the text content of a node (and its subnodes)
my $content = getTextContents($node);

XML::DOM::BagOfTricks provides a bundle, or bag, of functions that make dealing with and creating DOM objects easier.

The goal of this BagOfTricks is to deal with DOM and XML in a more perl friendly manner, using native idioms to fit in with the rest of a perl program.

As of version 0.02 the API has changed to be clearer and more in line with the DOM API in general, now using createFoo instead of getFoo to create new elements, documents, etc.

Requirements:
Perl

XML::DOM::BagOfTricks 0.05 search tags