|
|
 |
perl-xml
Getting encoding declaration with XML::SAX
by Timothy Appnel other posts by this author
Feb 28 2006 1:28PM messages near this date
view in the new Beta List Site
Re: XML::LibXSLT callbacks - trying to "fake" the namespace prefix
|
Re: Getting encoding declaration with XML::SAX
& XSLT I'm trying to write some code that will parse an XML document and
optionally reserialize it back. I have to expect character sets other
then utf-8 will be passed in. The problem I'm running into is getting
the declared encoding out of the XML while parsing with XML::SAX.
set_document_locator doesn't pick up the encoding declaration. I've
tried a couple of different parsers and feeds with different
encodings. Still no love. Here is a test script I'm running...
#!/usr/bin/perl -w
use strict;
use XML::SAX::ParserFactory;
my $handler = XML::SAX::Foo-> new();
my $p = XML::SAX::ParserFactory-> parser(Handler => $handler);
$p-> parse_file('atom.xml'); # http://www.sixapart.jp/atom.xml
package XML::SAX::Foo;
use base qw( XML::SAX::Base );
use Data::Dumper;
sub set_document_locator { print Dumper(@_) }
What am I do wrong here? Why is the declared encoding information so
difficult to determine?
<tim/>
--
Timothy Appnel
http://www.timaoutloud.org/
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Timothy Appnel
Dominic Mitchell
A. Pollock
Timothy Appnel
A. Pagaltzis
A. Pagaltzis
|
|
|
 |
|