SVG::DOM is a Perl library with DOM (Document Object Model) methods for SVG objects.
SVG::DOM provides a selection of methods for accessing and manipulating SVG elements through DOM-like methods such as getElements, getChildren, getNextSibling and so on.
Currently only methods that provide read operations are supported. Methods to manipulate SVG elements will be added in a future release.
SYNOPSIS
my $svg=new SVG(id=>"svg_dom_synopsis", width=>"100", height=>"100");
my %attributes=$svg->getAttributes;
my $group=$svg->group(id=>"group_1");
my $name=$group->getElementName;
my $id=$group->getElementID;
$group->circle(id=>"circle_1", cx=>20, cy=>20, r=>5, fill=>"red");
my $rect=$group->rect(id=>"rect_1", x=>10, y=>10, width=>20, height=>30);
my $width=$rect->getAttribute("width");
my $has_children=$group->hasChildren();
my @children=$group->getChildren();
my $kid=$group->getFirstChild();
do {
print $kid->xmlify();
} while ($kid=$kid->getNextSibling);
my @ancestors=$rect->getParents();
my $is_ancestor=$group->isAncestor($rect);
my $is_descendant=$rect->isDescendant($svg);
my @rectangles=$svg->getElements("rect");
my $allelements_arrayref=$svg->getElements();
...and so on...
Product's homepage
Requirements:
· Perl