[PerlChina] XML中文

Fayland Lam fayland at gmail.com
Tue Aug 12 19:47:44 PDT 2008


Question wrote:
> Hi,
> 现在想用perl解析一个asx(xml)文件,现在用XML::DOM发现不支持中文。

http://wiki.perlchina.org/index.php/Perl-XML-FAQ
http://wiki.perlchina.org/index.php/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8BPerl_XML%EF%BC%9A%E6%8E%A5%E5%8F%A3%E7%AF%87

一般来说,最好你去解析 utf8 的 xml 文件
如果需要解析 gb2312 的文件的话,下载
http://www.fayland.org/misc/backup/gb2312.enc
找到 XML::Parser 的地址

bash-3.00$ perldoc -l XML::Parser
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/XML/Parser.pm

然后下载过去放到
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/XML/Parser/Encodings/
下试试。

Thanks.

> 文件大概是这样的:
>
> <asx version = "3.0">
> <title>视频</title>
> <abstract></abstract>
> </asx>
>
> google了一圈没什么结果,自己用regex匹配太累。
> 各位有什么办法么?
>
>
> -- 
> >: ~
> ------------------------------------------------------------------------
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm


-- 
Fayland Lam // http://www.fayland.org/ 
Foorum based on Catalyst // http://www.foorumbbs.com/ 



More information about the China-pm mailing list