Thanks ! it worked ! On Wed, Apr 2, 2008 at 1:31 AM, Konstantin Veretennicov < [EMAIL PROTECTED]> wrote:
> On Tue, Apr 1, 2008 at 10:42 PM, Alok Kothari <[EMAIL PROTECTED]> > wrote: > > > Hello, > > I am new to XML parsing.Could you kindly tell me whats the > > problem with the following code: > > > > import xml.dom.minidom > > import xml.parsers.expat > > document = """<token pos="nn">Letterman</token><token pos="bez">is</ > > token><token pos="jjr">better</token><token pos="cs">than</ > > token><token pos="np">Jay</token><token pos="np">Leno</token>""" > > > > This document is not well-formed. It doesn't have root element. > > ... > > > > > > Traceback (most recent call last): > > File "C:/Python25/Programs/eg.py", line 20, in <module> > > p.Parse(document, 1) > > ExpatError: junk after document element: line 1, column 33 > > > > Told ya :) > > > Try wrapping your document in root element, like > "<tokens><token>...</token><token>...</token></tokens>" > > -- > kv >
-- http://mail.python.org/mailman/listinfo/python-list