Accessing name part of attributes using XML::LIbXML::Attr class
by Ira T Taylor other posts by this author
Jun 10 2009 6:40AM messages near this date
view in the new Beta List Site
|
Re: Accessing name part of attributes using XML::LIbXML::Attr class
& XSLT XML::LibXML::Nodes has a method:
attributes
@attributelist = $node-> attributes();
This function returns all attributes and namespace declarations assigned
to the given node.
Because XML::LibXML does not implement namespace declarations and
attributes the same way, it is required to test what kind of node is
handled while accessing the functions result.
If this function is called in array context the attribute nodes are
returned as an array. In scalar context the function will return a
XML::LibXML::NamedNodeMap object.
I am using the XML::LibXML::Iterator class. I can access the value part
of an attribute using the getValue() method of the Attr class, but I can't
figure out how to access the value part of the attribute. It can't find
any reference to the NamedNodeMap anywheres.
@attributeslist = $curnode-> attributes();
foreach $value (@attributeslist) {
$string = $value-> getValue();
print "name " . $name-> nodeName() . " value $string\n"
Any help would be appreciated,
Ira Taylor
Thread:
Ira T Taylor
Michael Ludwig
|