On Tue, Apr 1, 2008 at 10:42 PM, Alok Kothari <<a href="mailto:kothari.alok@gmail.com">kothari.alok@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
          I am new to XML parsing.Could you kindly tell me whats the<br>
problem with the following code:<br>
<br>
import xml.dom.minidom<br>
import xml.parsers.expat<br>
document = """<token pos="nn">Letterman</token><token pos="bez">is</<br>
token><token pos="jjr">better</token><token pos="cs">than</<br>
token><token pos="np">Jay</token><token pos="np">Leno</token>"""<br>
</blockquote><div><br>This document is not well-formed. It doesn't have root element.<br><br>...<br></div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>
Traceback (most recent call last):<br>
  File "C:/Python25/Programs/eg.py", line 20, in <module><br>
    p.Parse(document, 1)<br>
ExpatError: junk after document element: line 1, column 33<br>
<font color="#888888"></font></blockquote><div><br>Told ya :)<br><br><br>Try wrapping your document in root element, like "<tokens><token>...</token><token>...</token></tokens>"<br>
<br>--<br>kv<br></div></div>