XML无法解释 提示错误 ExpatError: unknown encoding: line 1, column 30

XML无法解释 提示错误 ExpatError: unknown encoding: line 1, column 30

>>> xmldoc = minidom.parse('c:\\aa.XML')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\xml\dom\minidom.py", line 1915, in parse
    return expatbuilder.parse(file)
  File "C:\Python24\lib\xml\dom\expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "C:\Python24\lib\xml\dom\expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: unknown encoding: line 1, column 30

#coding=utf-8
expat不认识aa.xml里面的gb编码,
一个方法你直接替换aa.xml 里面的encode变成iso8859-1
还有就是把整个aa.xml转换成utf8


QUOTE:
原帖由 bs 于 2007-1-25 16:52 发表
#coding=utf-8

#coding=utf-8
>>> from xml.dom import minidom
>>> xmldoc = minidom.parse('c:\\aa.XML')

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in -toplevel-
    xmldoc = minidom.parse('c:\\aa.XML')
  File "C:\Python24\lib\xml\dom\minidom.py", line 1915, in parse
    return expatbuilder.parse(file)
  File "C:\Python24\lib\xml\dom\expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "C:\Python24\lib\xml\dom\expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: unknown encoding: line 1, column 30
>>>
我这样写了,还是无法解释,能不能给修正一下
和你的python编码没有关系,expat库不认识双字节编码


QUOTE:
原帖由 ttvast 于 2007-1-25 17:39 发表
和你的python编码没有关系,expat库不认识双字节编码

如何让expat 识别双字节??