Re: Parse XML using Python

2004-12-10 Thread Uche Ogbuji
This is a neat solution. You can parse any well-formed general entitity (e.g. Anil's document with multiple root nodes) in 4Suite 1.0a4: from Ft.Xml.Domlette import EntityReader s = """ eggs more eggs """ docfrag = EntityReader.parseString(s, 'http://foo/test/spam.xml') docfrag is now ready for

Re: Parse XML using Python

2004-12-09 Thread Anil
William Park wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > > I wanted to write a script that will read the below file: > > > > > > . > > > > > > > > .. > > > > .. > > > > > > > > .. > > > > .. > > > > .. > > > > . > > . > > > > . > > > > > > > > .. > > > > > > > > .. > > >

Re: Parse XML using Python

2004-12-09 Thread William Park
[EMAIL PROTECTED] wrote: > Hi, > > I wanted to write a script that will read the below file: > > > . > > > > .. > > .. > > > > .. > > .. > > .. > > . > . > > . > > > > .. > > > > .. > > > > > > .. > and so on > > The output of the script shud be > > ABC > ..EFGA >

Re: Parse XML using Python

2004-12-09 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > > > . > . > > > > .. > and so on an XML document can only have a single root element, but your example has at least two top-level elements (abcd and xyz). here is some elementtree code that handles this by wrapping your data in a "root" element. from elementtr

Re: Parse XML using Python

2004-12-09 Thread Jeremy Bowers
On Thu, 09 Dec 2004 06:00:27 -0800, Anil wrote: > > Thomas Guettler wrote: >> Hi, >> >> Here is an example how to use sax: >> >> http://pyxml.sourceforge.net/topics/howto/node12.html >> >> Thomas >> >> -- >> Thomas GÃttler, http://www.thomas-guettler.de/ > > > Could you please tell me how to a

Re: Parse XML using Python

2004-12-09 Thread Diez B. Roggisch
Anil wrote: > Could you please tell me how to achieve the below. > I am interested in getting the output like: > > ABC > EFGA --> child of ABC > ABDG --> child of AEFGA > MON --> child of ABC > A1 > FGA --> child of A1 > BG--> child of FGA print """ ABC EFGA --> child of

Re: Parse XML using Python

2004-12-09 Thread Anil
Thomas Guettler wrote: > Am Wed, 08 Dec 2004 23:25:49 -0800 schrieb anilby: > > > Hi, > > > > I wanted to write a script that will read the below file: > > Hi, > > Here is an example how to use sax: > > http://pyxml.sourceforge.net/topics/howto/node12.html > > Thomas > > -- > Thomas Güttler, http

Re: Parse XML using Python

2004-12-09 Thread Thomas Guettler
Am Wed, 08 Dec 2004 23:25:49 -0800 schrieb anilby: > Hi, > > I wanted to write a script that will read the below file: Hi, Here is an example how to use sax: http://pyxml.sourceforge.net/topics/howto/node12.html Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.pyt

Parse XML using Python

2004-12-08 Thread anilby
Hi, I wanted to write a script that will read the below file: . .. .. .. .. .. . . . .. .. .. and so on The output of the script shud be ABC ..EFGA ABDG ..MON A1 ..FGA BG Please help me in writing a Python script for the above task. Regards, Anil. -- h