python 解析xml遇到xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 4, column 34

在調試數字驅動用xml文件的方式時,包含讀取xml文件的步驟,運行程序報錯:python

d:\test\0629>python XmlUtil.py
Traceback (most recent call last):
  File "XmlUtil.py", line 59, in <module>
    datas = xml.getDataFromXml()
  File "XmlUtil.py", line 45, in getDataFromXml
    root = self.getRoot()
  File "XmlUtil.py", line 17, in getRoot
    tree = ElementTree.parse(self.xmlPath)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 656, in parse
    parser.feed(data)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1659, in feed
    self._raiseerror(v)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1523, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 4, column 34調試

xml文件是本身手動新建的,內容是本身敲上去的,對比以前的好用的xml文件的內容,並無問題,注意力開始放在代碼上了,怎麼改都不行,後來幾經調試,發現從新替換了xml文件就行了,文件內容檢查過,並無問題,是個奇怪的問題,目前尚未重現orm

先記錄一下這個問題xml

相關文章
相關標籤/搜索