I am trying to modify an attribute value in an XML file using LibXML. Here is the part of my 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 is the script i tried.
#!usr/bin/env perl -w
use strict;
use warnings;
use XML::LibXML;
use Data::Dumper;
my $filename="/path/filename.xml";
my $parser=XML::LibXML->new();
my $doc=$parser->parse_file($filename);
my $xpath='/meta-data/approved-by/@approved';
print Dumper $doc->findvalue($xpath);
my ($attr) = $doc->findnodes($xpath);
$attr->setValue('Yes');
print Dumper $doc->findvalue($xpath);
When i execute this script, i get an error message like.
C:\Windows\System32>perl C:\path\perl\sample3.pl
Could not create file parser context for file "/C:/path/1_
1543-CRA 119 1364_2.xml": Result too large at C:\path\perl\sample3.pl line 8
I understand that it is not able to parse, but why? My xml file is a huge one. Is it the problem or is it with my script? please guide me what shld i do. Thanks.