J
Jay Dorsey
Carlo said:Hi all,
when I try to Parse a sample XML ducument Python display the follow error
message:
---------------------------------------------------------------------------
Traceback (most recent call last):
File "./mysql.py", line 57, in ?
DOM=xml.dom.minidom.parseString(XML)
File "/usr/local/lib/python2.3/xml/dom/minidom.py", line 1925, in
parseString
return expatbuilder.parseString(string)
File "/usr/local/lib/python2.3/xml/dom/expatbuilder.py", line 940, in
parseString
return builder.parseString(string)
File "/usr/local/lib/python2.3/xml/dom/expatbuilder.py", line 223, in
parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 1, column 112
----------------------------------------------------------------------------
I used xml.dom.minodom module and the source code is:
#!/usr/local/bin/python
import xml.dom.minidom
XML="""<?xml version="1.0"?><tabedata><row><EMPLOYEE_ID>55></EMPLOYEE_ID>
<FIRST>Carlo</FIRST><LAST>Sette</LAST></row></tabledata>"""
I would guess that its either the misspelling of the first <tabledata>
tag (missing an L), or the unescaped > sign right after the 55. If
these were typos when you transcribed to the e-mail, check your
script--you might have other typos in your XML string.
Also, I believe entity names are generally lowercase; i.e. <employee_id>
vs. <EMPLOYEE_ID>. I don't work w/ XML enough to recall if this is
required or not; so disregard if I'm way off base
Jay