http://slis-two.lis.fsu.edu/~xml/sample.html and saved
it as samplexml.xml. Please note that I removed the
following line
<!DOCTYPE DOCUMENT SYSTEM "simple.dtd ">
from the original xml sample.
<?XML version="1.0" encoding="UTF-8"?>
<DOCUMENT trackNum="1234" >
<TITLE> Sample Document </TITLE>
<AUTHOR> <FIRSTNAME> Brandon </FIRSTNAME>
<LASTNAME> Voss </LASTNAME>
<COMPANY> The XML Pages </COMPANY> </AUTHOR>
<SUMMARY> This is element text and an entity
follows:&Descri ption;
</SUMMARY>
</DOCUMENT>
Then, I attempted to parse this xml document with the
following python code, which is saved as xmltest.py.
from xml.dom import minidom
xmldoc = minidom.parse(' sample.xml')
print xmldoc.toxml()
I got the following error message:
Traceback (most recent call last):
File "C:\Python23\co des\xmltest.py" , line 4, in
-toplevel-
xmldoc = minidom.parse(' samplexml.xml')
File "C:\Python23\li b\xml\dom\minid om.py", line
1919, in parse
return expatbuilder.pa rse(file)
File "C:\Python23\li b\xml\dom\expat builder.py", line
924, in parse
result = builder.parseFi le(fp)
File "C:\Python23\li b\xml\dom\expat builder.py", line
207, in parseFile
parser.Parse(bu ffer, 0)
ExpatError: not well-formed (invalid token): line 1,
column 5
I have no clue why that xml document is not
well-formed.
Any hint please?
_______________ _______________ ____
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com