amitp2011 has asked for the wisdom of the Perl Monks concerning the following question:
I have to update the value of a node by based on the value of one of its attributes.
<ReferenceID referenceIDType="FXDD">FXDDILN233</ReferenceID> For the above Tag. i want to edit the value FXDDILN233 based on the attribute value referenceIDType="FXDD"
I tried the below code:But getting error on the setData line.. Whats is it that could be wrong ? Thanks in advance.my $nodeset = $doc->findnodes("//*[name()='ReferenceID']"); foreach my $node ($nodeset->get_nodelist) { if ($node->hasAttribute("referenceIDType") == XML::LibXML::Boolean- +>True) { $RetVal = $node->getAttributeNode("referenceIDType")->getValue(); if ($RetVal eq "FDD") { print "Attribute VAL=@@@@@@@@@@@@"."$RetVal \n"; $node->setData("$NodeVal"); } } }
|
|---|