[Home] [By Thread] [By Date] [Recent Entries]


Daben Liu wrote:
> The XML::Parser installed from CPAN does not come with a 
> GB2312 encoding support. However, I was not able to add 
> the support as instructed by the XML::Encoding package.
> 
> Then I made the following perl script:
> ---------------
> #!/usr/bin/perl
> use XML::Parser;
> 
> my $xmlfile = $ARGV[0];
> my $parser = new XML::Parser();
> my $doc = $parser->parsefile ("$xmlfile");
> ---------------

This is where your error is. As explained in the XML::Encoding 
documentation, XML::Encoding is a *subclass* of XML::Parser. In order to 
use it, you need to replace all occurences of XML::Parser in your script 
with XML::Encoding.

The perl-xml list from ActiveState may be a better source of information 
on the topic.

As a side-note, XML::Parser is pretty much considered to be deprecated 
by the Perl XML community. Nowadays people tend to take their pick from 
one of the many SAX2 parsers that are on CPAN.

-- 
Robin Berjon <robin.berjon@e...>
Research Engineer, Expway
7FC0 6F5F D864 EFB8 08CE  8E74 58E6 D5DB 4889 2488


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member