ElementTree and DTDs

  • Thread starter J. Pablo Fernández
  • Start date
J

J. Pablo Fernández

Hello,

Is ElementTree supposed to load DTDs? I have some xmls heavy on
entities and it fails this way:

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 862, in
parse
tree.parse(source, parser)
File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 586, in
parse
parser.feed(data)
File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1245, in
feed
self._parser.Parse(data, 0)
File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1201, in
_default
self._parser.ErrorColumnNumber)
xml.parsers.expat.ExpatError: undefined entity &jcirc;: line 13,
column 10Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 45, in parse
File "<string>", line 32, in parse
SyntaxError: undefined entity &c_j;: line 46, column 17

Thanks.
 
J

J. Pablo Fernández

Or is there another library that would handle DTDs correctly,
performing entity replacements?

Thanks.

Hello,

Is ElementTree supposed to load DTDs? I have some xmls heavy on
entities and it fails this way:

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.>>> filename = "revo/xml/a.xml"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 862, in
parse
    tree.parse(source, parser)
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 586, in
parse
    parser.feed(data)
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1245, in
feed
    self._parser.Parse(data, 0)
  File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1201, in
_default
    self._parser.ErrorColumnNumber)
xml.parsers.expat.ExpatError: undefined entity &jcirc;: line 13,
column 10>>> import xml.etree.cElementTree as ET
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 45, in parse
  File "<string>", line 32, in parse
SyntaxError: undefined entity &c_j;: line 46, column 17

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top