.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SVG::DOM 3pm"
.TH SVG::DOM 3pm "2015-06-02" "perl v5.20.2" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
SVG::DOM \- A library of DOM (Document Object Model) methods for SVG objects.
.SH "SUMMARY"
.IX Header "SUMMARY"
\&\s-1SVG::DOM\s0 provides a selection of methods for accessing and manipulating \s-1SVG\s0
elements through DOM-like methods such as getElements, getChildren, getNextSibling
and so on.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& 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();
\&
\& $group\->insertBefore($newChild,$rect);
\& $group\->insertAfter($newChild,$rect);
\& $rect = $group\->replaceChild($newChild,$rect);
\& $group\->removeChild($newChild);
\& my $newRect = $rect\->cloneNode($deep);
\&
\& ...and so on...
.Ve
.SH "METHODS"
.IX Header "METHODS"
.ie n .SS "@elements = $obj\->getElements($element_name)"
.el .SS "\f(CW@elements\fP = \f(CW$obj\fP\->getElements($element_name)"
.IX Subsection "@elements = $obj->getElements($element_name)"
Return a list of all elements with the specified name (i.e. type) in the document. If
no element name is provided, returns a list of all elements in the document.
In scalar context returns an array reference.
.ie n .SS "@children = $obj\->\fIgetChildren()\fP"
.el .SS "\f(CW@children\fP = \f(CW$obj\fP\->\fIgetChildren()\fP"
.IX Subsection "@children = $obj->getChildren()"
Return a list of all children defined on the current node, or undef if there are no children.
In scalar context returns an array reference.
.PP
Alias: \fIgetChildElements()\fR, \fIgetChildNodes()\fR
.ie n .SS "@children = $obj\->\fIhasChildren()\fP"
.el .SS "\f(CW@children\fP = \f(CW$obj\fP\->\fIhasChildren()\fP"
.IX Subsection "@children = $obj->hasChildren()"
Return 1 if the current node has children, or 0 if there are no children.
.PP
Alias: hasChildElements, \fIhasChildNodes()\fR
.ie n .SS "$ref = $obj\->\fIgetFirstChild()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetFirstChild()\fP"
.IX Subsection "$ref = $obj->getFirstChild()"
Return the first child element of the current node, or undef if there are no children.
.ie n .SS "$ref = $obj\->\fIgetLastChild()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetLastChild()\fP"
.IX Subsection "$ref = $obj->getLastChild()"
Return the last child element of the current node, or undef if there are no children.
.ie n .SS "$ref = $obj\->\fIgetSiblings()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetSiblings()\fP"
.IX Subsection "$ref = $obj->getSiblings()"
Return a list of all children defined on the parent node, containing the current node.
.ie n .SS "$ref = $obj\->\fIgetNextSibling()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetNextSibling()\fP"
.IX Subsection "$ref = $obj->getNextSibling()"
Return the next child element of the parent node, or undef if this is the last child.
.ie n .SS "$ref = $obj\->\fIgetPreviousSibling()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetPreviousSibling()\fP"
.IX Subsection "$ref = $obj->getPreviousSibling()"
Return the previous child element of the parent node, or undef if this is the first child.
.ie n .SS "$index = $obj\->\fIgetChildIndex()\fP"
.el .SS "\f(CW$index\fP = \f(CW$obj\fP\->\fIgetChildIndex()\fP"
.IX Subsection "$index = $obj->getChildIndex()"
Return the place of this element in the parent node's list of children, starting from 0.
.ie n .SS "$element = $obj\->getChildAtIndex($index)"
.el .SS "\f(CW$element\fP = \f(CW$obj\fP\->getChildAtIndex($index)"
.IX Subsection "$element = $obj->getChildAtIndex($index)"
Returns the child element at the specified index in the parent node's list of children.
.ie n .SS "$ref = $obj\->\fIgetParentElement()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetParentElement()\fP"
.IX Subsection "$ref = $obj->getParentElement()"
Return the parent of the current node.
.PP
Alias: \fIgetParent()\fR
.ie n .SS "@refs = $obj\->\fIgetParentElements()\fP"
.el .SS "\f(CW@refs\fP = \f(CW$obj\fP\->\fIgetParentElements()\fP"
.IX Subsection "@refs = $obj->getParentElements()"
Return a list of the parents of the current node, starting from the immediate parent. The
last member of the list should be the document element.
.PP
Alias: \fIgetParents()\fR
.ie n .SS "$name = $obj\->\fIgetElementName()\fP"
.el .SS "\f(CW$name\fP = \f(CW$obj\fP\->\fIgetElementName()\fP"
.IX Subsection "$name = $obj->getElementName()"
Return a string containing the name (i.e. the type, not the \s-1ID\s0) of an element.
.PP
Alias: \fIgetType()\fR, \fIgetTagName()\fR, \fIgetNodeName()\fR
.ie n .SS "$ref = $svg\->getElementByID($id)"
.el .SS "\f(CW$ref\fP = \f(CW$svg\fP\->getElementByID($id)"
.IX Subsection "$ref = $svg->getElementByID($id)"
Alias: \fIgetElementbyID()\fR
.PP
Return a reference to the element which has \s-1ID\s0 \f(CW$id\fR, or undef if no element with this \s-1ID\s0 exists.
.ie n .SS "$id = $obj\->\fIgetElementID()\fP"
.el .SS "\f(CW$id\fP = \f(CW$obj\fP\->\fIgetElementID()\fP"
.IX Subsection "$id = $obj->getElementID()"
Return a string containing the \s-1ID\s0 of the current node, or undef if it has no \s-1ID.\s0
.ie n .SS "$ref = $obj\->\fIgetAttributes()\fP"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->\fIgetAttributes()\fP"
.IX Subsection "$ref = $obj->getAttributes()"
Return a hash reference of attribute names and values for the current node.
.ie n .SS "$value = $obj\->getAttribute($name);"
.el .SS "\f(CW$value\fP = \f(CW$obj\fP\->getAttribute($name);"
.IX Subsection "$value = $obj->getAttribute($name);"
Return the string value attribute value for an attribute of name \f(CW$name\fR.
.ie n .SS "$ref = $obj\->setAttributes({name1=>$value1,name2=>undef,name3=>$value3})"
.el .SS "\f(CW$ref\fP = \f(CW$obj\fP\->setAttributes({name1=>$value1,name2=>undef,name3=>$value3})"
.IX Subsection "$ref = $obj->setAttributes({name1=>$value1,name2=>undef,name3=>$value3})"
Set a set of attributes. If \f(CW$value\fR is undef, deletes the attribute.
.ie n .SS "$value = $obj\->setAttribute($name,$value);"
.el .SS "\f(CW$value\fP = \f(CW$obj\fP\->setAttribute($name,$value);"
.IX Subsection "$value = $obj->setAttribute($name,$value);"
Set attribute \f(CW$name\fR to \f(CW$value\fR. If \f(CW$value\fR is undef, deletes the attribute.
.ie n .SS "$cdata = $obj\->\fIgetCDATA()\fP"
.el .SS "\f(CW$cdata\fP = \f(CW$obj\fP\->\fIgetCDATA()\fP"
.IX Subsection "$cdata = $obj->getCDATA()"
Return the cannonical data (i.e. textual content) of the current node.
.PP
Alias: \fIgetCdata()\fR, \fIgetData()\fR
.ie n .SS "$boolean = $obj\->isAncestor($element)"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->isAncestor($element)"
.IX Subsection "$boolean = $obj->isAncestor($element)"
Returns 1 if the current node is an ancestor of the specified element, otherwise 0.
.ie n .SS "$boolean = $obj\->isDescendant($element)"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->isDescendant($element)"
.IX Subsection "$boolean = $obj->isDescendant($element)"
Returns 1 if the current node is a descendant of the specified element, otherwise 0.
.ie n .SS "$boolean = $obj\->insertBefore( $element, $child );"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->insertBefore( \f(CW$element\fP, \f(CW$child\fP );"
.IX Subsection "$boolean = $obj->insertBefore( $element, $child );"
Returns 1 if \f(CW$element\fR was successfully inserted before \f(CW$child\fR in \f(CW$obj\fR
.ie n .SS "$boolean = $obj\->insertAfter( $element, $child );"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->insertAfter( \f(CW$element\fP, \f(CW$child\fP );"
.IX Subsection "$boolean = $obj->insertAfter( $element, $child );"
Returns 1 if \f(CW$element\fR was successfully inserted after \f(CW$child\fR in \f(CW$obj\fR
.ie n .SS "$boolean = $obj\->insertSiblingBefore( $element );"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->insertSiblingBefore( \f(CW$element\fP );"
.IX Subsection "$boolean = $obj->insertSiblingBefore( $element );"
Returns 1 if \f(CW$element\fR was successfully inserted before \f(CW$obj\fR
.ie n .SS "$boolean = $obj\->insertSiblingAfter( $element );"
.el .SS "\f(CW$boolean\fP = \f(CW$obj\fP\->insertSiblingAfter( \f(CW$element\fP );"
.IX Subsection "$boolean = $obj->insertSiblingAfter( $element );"
Returns 1 if \f(CW$element\fR was successfully inserted after \f(CW$obj\fR
.ie n .SS "$element = $obj\->replaceChild( $element, $child );"
.el .SS "\f(CW$element\fP = \f(CW$obj\fP\->replaceChild( \f(CW$element\fP, \f(CW$child\fP );"
.IX Subsection "$element = $obj->replaceChild( $element, $child );"
Returns \f(CW$child\fR if \f(CW$element\fR successfully replaced \f(CW$child\fR in \f(CW$obj\fR
.ie n .SS "$element = $obj\->removeChild( $child );"
.el .SS "\f(CW$element\fP = \f(CW$obj\fP\->removeChild( \f(CW$child\fP );"
.IX Subsection "$element = $obj->removeChild( $child );"
Returns \f(CW$child\fR if it was removed successfully from \f(CW$obj\fR
.ie n .SS "$element = $obj\->cloneNode( $deep );"
.el .SS "\f(CW$element\fP = \f(CW$obj\fP\->cloneNode( \f(CW$deep\fP );"
.IX Subsection "$element = $obj->cloneNode( $deep );"
Returns a new \f(CW$element\fR clone of \f(CW$obj\fR, without parents or children. If deep is set to 1, all children are included recursively.
.SH "AUTHOR"
.IX Header "AUTHOR"
Ronan Oger, ronan@roitsystems.com
Martin Owens, doctormo@postmaster.co.uk
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIperl\fR\|(1), \s-1SVG\s0, \s-1SVG::XML\s0, SVG::Element, SVG::Parser
.PP
\s-1ROIT\s0 Systems: Commercial \s-1SVG\s0 perl solutions
\s-1SVG\s0 at the W3C