Parsing non utf-8 encoding XML in Python

"Xinzhi Zhao" <[email protected]> Fri, 12 Dec 2003 09:09:20 +0000
Newsgroups gmane.comp.web.zope.parsed-xml
Message-ID <[email protected]>
--===============0150146390==
Content-Type: text/html

<html><div style='background-color:'><DIV class=RTE>Hi,</DIV>
<DIV class=RTE>My XML files have to use other&nbsp;encoding, i.e.&nbsp;'gb2312', which is different from the default one 'utf-8'.</DIV>
<DIV class=RTE>When I was using the package from 4DOM(pyxml.souceforge.net) to parse my XML files,errors occured. The package for parsing XML only supports encoding 'utf-8', right?</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Is there any way to solve my problem? And how shall I do it?</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>-------------------------------------------------------------------------------</DIV>
<DIV class=RTE>-- &nbsp;My XML file give&nbsp;below</DIV>
<DIV class=RTE>--</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;?xml version = "1.0"&nbsp; encoding = "gb2312" ?&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;!-- This is my example. --&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;article&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;title&gt; ¼òµ¥µÄ XML&lt;/title&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;data&gt;December 12, 2003&lt;/data&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;author&gt;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp; &lt;name&gt;Xinzhi Zhao&lt;/name&gt;</DIV>
<DIV class=RTE>&lt;/author&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;summary&gt;Parsing XML&lt;/summary&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;content&gt;This XML include other encoding and it's runnable in IE6. However,parsing it in Python by DOM or SAX will be failed.How shall I do it?</DIV>
<DIV class=RTE>&lt;/content&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;/article&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>--------------------------------------------------------------------------------</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>I look forward to hearing from you.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Sincerely, </DIV>
<DIV class=RTE>Xinzhi Zhao</DIV></div><br clear=all><hr>Add photos to your messages with  <a href="http://g.msn.com/8HMBEN/2749??PS=">MSN 8. </a> Get 2 months FREE*.</html>


--===============0150146390==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Parsed-XML-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/parsed-xml-dev

--===============0150146390==--