ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: problem adding new encoding to perl XML::Parser
by Duncan Cameron other posts by this author
Sep 4 2002 7:20AM messages near this date
view in the new Beta List Site
Re: ANNOUNCE: XML::LibXSLT 1.52 | Re: problem adding new encoding to perl XML::Parser
On 2002-09-04 Robin Berjon wrote:
> On Thursday 29 August 2002 18:07, 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.
> > Note that the OS is Linux.
> >
> > To add this support, I did the following:
> >
> > 1. Download GB2312.TXT from ftp.unicode.org
> > 2. Download the XML::Encoding 1.01 and get two binaries:
> >    make_encmap and compile_encoding
> > 3. run make_encmap as follows:
> >    make_encmap GB2312 GB2312.TXT > GB2312.encmap
> > 4. Add expat='yes' to the first line of GB2312.encmap
> > 5. run compile_encoding:
> >    compile_encoding -o GB2312.enc GB2312.encmap
> > 6. copy GB2312.enc to
> >    /usr/lib/perl5/site_perl/5.005/i386-linux/XML/Parser/Encodings
> >
> > 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");
> > ---------------
> 
> I think I answered that question on xml-dev a week or two ago when you posted 
> it there, did you not get it? Perhaps it got lost, their list manager is 
> constantly having trouble.
> 
> In any case, XML::Encoding being a subclass of XML::Parser, you should 
> replace all occurences of XML::Parser in your script with XML::Encoding.

You're misunderstanding XML::Encoding.  It *is* a subclass of
XML::Parser but its purpose is simply to parse encoding map files
in order to create new binary encodings for XML::Parser.

>  And 
> unless you have a *very* good reason to use XML::Parser, you should use a 
> SAX2 parser instead.
> 
The poster clearly wanted to parse documents with GB2313 encoding
which XML::Parser should be able to do. Can we recommend other XML
parsers (SAX or not) which support that encoding?  The SAX2 comment
doesn't seem directly relevant to his problem.

Regards,
Duncan Cameron





_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Duncan Cameron
Robin Berjon

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved