XML::TinyXML::Node - Tinyxml Node object
use XML::TinyXML; # first obtain an xml context: $xml = XML::TinyXML->new("rootnode", "somevalue", { attr1 => v1, attr2 => v2 }); # We create a node and later attach it to a parent one doing: $child_node = XML::TinyXML::Node->new("child", "somevalue"); ... [ some code ] ... $parent_node->addChildNode($child_node); # or if we want to create a childnode in a single statemnet $child_node = XML::TinyXML::Node->new("child", "somevalue", $parent_node); # we can later retrive the "child" node by calling $child_node = $xml->getNode("/nodelabel/child"); # at this point , calling : print $xml->dump; # would produce the following xml # # <?xml version="1.0"?> # <rootnode> # <child>othervalue</child> # </rootnode>
Node representation for the TinyXML API
_node
Reference to the underlying XmlNodePtr object (which is a binding to the XmlNode C structure)
new ($entity, $value, $parent, %attrs)
Creates a new XML::TinyXML::Node object.
$entity can be either a scalar or an XmlNodePtr object. - if it's a scalar , it will be intepreted as the entity name - if it's an XmlNodePtr, it will be used as the underlying object and will be incapsulated in the newly created XML::TinyXML::Node object.
$value is the optianal string value of the newly created node (the "content" of the xml node)
if $parent isn't undef the newly created node will be directly attached to the specified parent node. $parent can be either a XML::TinyXML::Node object or a XmlNodePtr one.
%attrs is an optional hash specifying attributes for the newly created xml node
Returns a valid XML::TinyXML::Node object
cleanAttributes
loadHash ($hash, [ $nest ])
toHash ([ $parent ])
updateAttributes (%attrs)
addAttributes (%attrs)
name ([$newname])
value ([$newval])
attributes ()
Read-Only method to obtain an hashref to the attributes of this node
getChildNode ($index)
getChildNodeByName ($name)
countChildren ()
children ()
addChildNode ($child)
parent ($child)
type () Returns the "type" of a XML::TinyXML::Node object. type can be : NODE COMMENT CDATA
XML::TinyXML
xant, <xant@cpan.org>
Copyright (C) 2008 by xant
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install XML::TinyXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::TinyXML
CPAN shell
perl -MCPAN -e shell install XML::TinyXML
For more information on module installation, please visit the detailed CPAN module installation guide.