| Store | Cart

What is wrong? The minidom or the XML file?

From: Peter Abel <Pete...@gmx.net>
10 Mar 2004 13:35:45 -0800
Anthony Liu <antonyliu2002 at yahoo.com> wrote in message news:<mailman.213.1078910068.19534.python-list at python.org>...
> I copy-pasted the following sample xml document from> 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:&Description;> </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\codes\xmltest.py", line 4, in> -toplevel->     xmldoc = minidom.parse('samplexml.xml')>   File "C:\Python23\lib\xml\dom\minidom.py", line> 1919, in parse>     return expatbuilder.parse(file)>   File "C:\Python23\lib\xml\dom\expatbuilder.py", line> 924, in parse>     result = builder.parseFile(fp)>   File "C:\Python23\lib\xml\dom\expatbuilder.py", line> 207, in parseFile>     parser.Parse(buffer, 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

One additional possibility to get another quick help about errors
in the xml-document is -  when working under MS-Windows - to  open
the document with the Internet Explorer up from version 5.xx
or so.
In your case it tells me exactly what Erik Max Francis told you.

Regards
Peter

Recent Messages in this Thread
Erik Max Francis Mar 10, 2004 10:08 am
Peter Abel Mar 10, 2004 09:35 pm
Messages in this thread