Modifying a tag's attribute value of an xml using XML::LibXML in perl -
i trying modify attribute value in xml file using libxml. here part of xml file
xmlns="urn:x-xxx:r2:reg-doc:1551-fad.110.05:en:*"> <meta-data><?pub dtl?> <confidentiality class="xxx-internal"/> <doc-name>xxx</doc-name> <doc-id> <doc-no type="registration">xxx</doc-no><language code="en"/><rev>a</rev> <date><y>2013</y><m>04</m><d>22</d></date> </doc-id> <company-id> <business-unit></business-unit> <company-name></company-name> <company-symbol logotype="xx"></company-symbol> </company-id> <title>xxx</title> <drafted-by> <person> <name>xxx</name><signature>xxx</signature> <location>in</location><company>xxx</company><department>bc</department> </person> </drafted-by> <approved-by approved="yes"> <person> <name>xxx</name><signature>xxx</signature> <location>in</location><company>xxx</company><department>bc</department> </person> </approved-by>
here script tried.
#!usr/bin/env perl -w use strict; use warnings; use xml::libxml; use data::dumper; $filename="/path/filename.xml"; $parser=xml::libxml->new(); $doc=$parser->parse_file($filename); $xpath='/meta-data/approved-by/@approved'; print dumper $doc->findvalue($xpath); ($attr) = $doc->findnodes($xpath); $attr->setvalue('yes'); print dumper $doc->findvalue($xpath);
when execute script, error message like.
c:\windows\system32>perl c:\path\perl\sample3.pl not create file parser context file "/c:/path/1_ 1543-cra 119 1364_2.xml": result large @ c:\path\perl\sample3.pl line 8
i understand not able parse, why? xml file huge one. problem or script? please guide me shld do. thanks.
if specified filename leading slash followed drive name, try remove leading slash. it's possible error message xml::libxml
misleading , should have been no such file or directory.
Comments
Post a Comment