Re: [Tutor] XML parsing

2018-03-30 Thread Neil Cerutti
On 2018-03-30, Stefan Behnel wrote: > Neil Cerutti schrieb am 30.03.2018 um 15:50: >> On 2018-03-30, Stefan Behnel wrote: >>> I admit that I'm being a bit strict here, there are certainly >>> cases where parsing the namespace from a tag is a sensible >>> thing to do. I'm really just saying that mo

Re: [Tutor] XML parsing

2018-03-30 Thread Stefan Behnel
Neil Cerutti schrieb am 30.03.2018 um 15:50: > On 2018-03-30, Stefan Behnel wrote: >> I admit that I'm being a bit strict here, there are certainly >> cases where parsing the namespace from a tag is a sensible >> thing to do. I'm really just saying that most of the time, when >> you feel the need t

Re: [Tutor] XML parsing

2018-03-30 Thread Neil Cerutti
On 2018-03-30, Stefan Behnel wrote: > I admit that I'm being a bit strict here, there are certainly > cases where parsing the namespace from a tag is a sensible > thing to do. I'm really just saying that most of the time, when > you feel the need to do that, it's worth reconsidering (or > asking)

Re: [Tutor] XML parsing

2018-03-30 Thread Stefan Behnel
Asif Iqbal schrieb am 30.03.2018 um 03:40: > On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten wrote: >> Asif Iqbal wrote: >>> On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten wrote: Asif Iqbal wrote: > Here is a sample xml file > > http://tail-f.com/ns/rest";> > http://networks.com/n

Re: [Tutor] XML parsing

2018-03-30 Thread Asif Iqbal
On Thu, Mar 29, 2018 at 9:40 PM, Asif Iqbal wrote: > > > On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten <__pete...@web.de> wrote: > >> Asif Iqbal wrote: >> >> > On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: >> > >> >> Asif Iqbal wrote: >> >> >> >> > I am trying to extract a

Re: [Tutor] XML parsing

2018-03-30 Thread Asif Iqbal
On Thu, Mar 29, 2018 at 3:41 PM, Peter Otten <__pete...@web.de> wrote: > Asif Iqbal wrote: > > > On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: > > > >> Asif Iqbal wrote: > >> > >> > I am trying to extract all the *template-name*s, but no success yet > >> > > >> > Here is a

Re: [Tutor] XML parsing

2018-03-29 Thread Peter Otten
Asif Iqbal wrote: > On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: > >> Asif Iqbal wrote: >> >> > I am trying to extract all the *template-name*s, but no success yet >> > >> > Here is a sample xml file >> > >> > http://tail-f.com/ns/rest";> >> > http://networks.com/nms";

Re: [Tutor] XML parsing

2018-03-29 Thread Asif Iqbal
On Thu, Mar 29, 2018 at 3:56 AM, Peter Otten <__pete...@web.de> wrote: > Asif Iqbal wrote: > > > I am trying to extract all the *template-name*s, but no success yet > > > > Here is a sample xml file > > > > http://tail-f.com/ns/rest";> > > http://networks.com/nms";> > > ALLFLEX-BLOOMINGTON >

Re: [Tutor] XML parsing

2018-03-29 Thread Peter Otten
Asif Iqbal wrote: > I am trying to extract all the *template-name*s, but no success yet > > Here is a sample xml file > > http://tail-f.com/ns/rest";> > http://networks.com/nms";> > ALLFLEX-BLOOMINGTON > post-staging > full-mesh > ALLFLEX > http://networks.com/nms";> >

[Tutor] XML parsing

2018-03-29 Thread Asif Iqbal
I am trying to extract all the *template-name*s, but no success yet Here is a sample xml file http://tail-f.com/ns/rest";> http://networks.com/nms";> ALLFLEX-BLOOMINGTON post-staging full-mesh ALLFLEX http://networks.com/nms";> advanced-plus 1000 true

Re: [Tutor] xml parsing from xml

2014-05-10 Thread Stefan Behnel
Stefan Behnel, 10.05.2014 10:57: > Danny Yoo, 07.05.2014 22:39: >> If you don't want to deal with a event-driven approach that SAX >> emphasizes, you may still be able to do this problem with an XML-Pull >> parser. You mention that your input is hundreds of megabytes long, in >> which case you pro

Re: [Tutor] xml parsing from xml

2014-05-10 Thread Stefan Behnel
Danny Yoo, 07.05.2014 22:39: > If you don't want to deal with a event-driven approach that SAX > emphasizes, you may still be able to do this problem with an XML-Pull > parser. You mention that your input is hundreds of megabytes long, in > which case you probably really do need to be careful abou

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Steven D'Aprano
On Wed, May 07, 2014 at 06:43:11PM +0530, jitendra gupta wrote: > Hi > > I just want to create a new xm file from existing xml file. so basically i > want to put contry details in countryName.xml from these file. > > I thought to do via read a line by line with normal file handling. but > there a

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Danny Yoo
To elaborate: from xml.dom.pulldom import START_ELEMENT, parse import io sampleData = u""" 2 2008 141100 5 2011 59900 69 20

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Danny Yoo
On Wed, May 7, 2014 at 1:26 PM, jitendra gupta wrote: > I cant use etree/SAX because there we cant get complete line , of course we > can get it by tag name but we are not sure about tag also. Only we know > what ever child of we need to put in new file with country name. Why can't you use su

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Neil D. Cerutti
On 5/7/2014 3:49 PM, Stefan Behnel wrote:> Neil D. Cerutti, 07.05.2014 20:04: >> In my own personal case, I partly prefer xml.sax simply because it ignores >> namespaces, a nice benefit in my cases. I wish I could make ElementTree do >> that. > > The downside of namespace unaware parsing is tha

Re: [Tutor] xml parsing from xml

2014-05-07 Thread jitendra gupta
no only XML (Complex) On Thu, May 8, 2014 at 1:51 AM, Danny Yoo wrote: > On Wed, May 7, 2014 at 6:13 AM, jitendra gupta > wrote: > > > I just want to create a new xm file from existing xml file. so basically > i > > want to put contry details in countryName.xml from these file. > > > > Side que

Re: [Tutor] xml parsing from xml

2014-05-07 Thread jitendra gupta
@All thanks, I cant use etree/SAX because there we cant get complete line , of course we can get it by tag name but we are not sure about tag also. Only we know what ever child of we need to put in new file with country name. Note: File size is around 800MB, for other requirement(Like converti

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Danny Yoo
On Wed, May 7, 2014 at 6:13 AM, jitendra gupta wrote: > I just want to create a new xm file from existing xml file. so basically i > want to put contry details in countryName.xml from these file. Side question: does your input have to be XML, or can it be in a simpler format such as JSON?

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Stefan Behnel
Neil D. Cerutti, 07.05.2014 20:04: > On 5/7/2014 1:39 PM, Alan Gauld wrote: >> On 07/05/14 17:56, Stefan Behnel wrote: >>> Alan Gauld, 07.05.2014 18:11: and ElementTree (aka etree). The documenation gives examples of both. sax is easiest and fastest for simple XML in big files ... >>> >>>

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Neil D. Cerutti
On 5/7/2014 1:39 PM, Alan Gauld wrote: On 07/05/14 17:56, Stefan Behnel wrote: Alan Gauld, 07.05.2014 18:11: and ElementTree (aka etree). The documenation gives examples of both. sax is easiest and fastest for simple XML in big files ... I wouldn't say that SAX qualifies as "easiest". Sure,

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Alan Gauld
On 07/05/14 17:56, Stefan Behnel wrote: Alan Gauld, 07.05.2014 18:11: and ElementTree (aka etree). The documenation gives examples of both. sax is easiest and fastest for simple XML in big files ... I wouldn't say that SAX qualifies as "easiest". Sure, if the task is something like "count nu

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Stefan Behnel
Alan Gauld, 07.05.2014 18:11: > Python comes with several XML parsers. The simplest to use are probably sax > and ElementTree (aka etree). The documenation gives examples of both. sax > is easiest and fastest for simple XML in big files while etree is probably > better for more complex XML structur

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Alan Gauld
On 07/05/14 14:13, jitendra gupta wrote: I thought to do via read a line by line with normal file handling. but there a problem with that. So i want to handle python XML . Could you please suggest on this. Python comes with several XML parsers. The simplest to use are probably sax and Element

Re: [Tutor] xml parsing from xml

2014-05-07 Thread Neil D. Cerutti
On 5/7/2014 9:13 AM, jitendra gupta wrote: Hi I just want to create a new xm file from existing xml file. so basically i want to put contry details in countryName.xml from these file. I thought to do via read a line by line with normal file handling. but there a problem with that. So i want to

[Tutor] xml parsing from xml

2014-05-07 Thread jitendra gupta
Hi I just want to create a new xm file from existing xml file. so basically i want to put contry details in countryName.xml from these file. I thought to do via read a line by line with normal file handling. but there a problem with that. So i want to handle python XML . Could you please suggest

Re: [Tutor] XML parsing when elements contain foreign characters

2014-01-09 Thread Stefan Behnel
Garry Bettle, 09.01.2014 09:50: > I'm trying to parse some XML and I'm struggling to reference elements that > contain foreign characters. I skipped over Steven's response and he apparently invested quite a bit of time in writing it up so nicely, so I can happily agree and just add one little comm

Re: [Tutor] XML parsing when elements contain foreign characters

2014-01-09 Thread Steven D'Aprano
On Thu, Jan 09, 2014 at 09:50:24AM +0100, Garry Bettle wrote: > I'm trying to parse some XML and I'm struggling to reference elements that > contain foreign characters. I see from your use of print that you're using Python 2. That means that strings '' are actually byte-strings, not text-strings

[Tutor] XML parsing when elements contain foreign characters

2014-01-09 Thread Garry Bettle
Howdy all, Have you hear the news? Happy New Year! Hope someone can help. I know this is a tutor list so please feel free to send me somewhere else. I'm trying to parse some XML and I'm struggling to reference elements that contain foreign characters. Code so far: # -*- coding: utf-8 -*- from

Re: [Tutor] xml parsing without a root element

2011-08-30 Thread rail shafigulin
On Tue, Aug 30, 2011 at 2:20 PM, Peter Otten <__pete...@web.de> wrote: > rail shafigulin wrote: > > > hello everyone. > > > > i need to parse a an xml-like file. the problem that i'm facing is that > > this file doesn't have the root element but in all other terms it is the > > same as xml, i.e >

Re: [Tutor] xml parsing without a root element

2011-08-30 Thread davidheiserca
Can you encapsulate the contents of the file in a root element before processing? - Original Message - From: rail shafigulin To: tutor@python.org Sent: Tuesday, August 30, 2011 10:27 AM Subject: [Tutor] xml parsing without a root element hello everyone. i need to

Re: [Tutor] xml parsing without a root element

2011-08-30 Thread Peter Otten
rail shafigulin wrote: > hello everyone. > > i need to parse a an xml-like file. the problem that i'm facing is that > this file doesn't have the root element but in all other terms it is the > same as xml, i.e > > > > > > > > > > does anybody know if there is a module in python that all

Re: [Tutor] xml parsing without a root element

2011-08-30 Thread Joel Goldstick
On Tue, Aug 30, 2011 at 1:27 PM, rail shafigulin wrote: > hello everyone. > > i need to parse a an xml-like file. the problem that i'm facing is that > this file doesn't have the root element but in all other terms it is the > same as xml, i.e > > > > > > > > > > does anybody know if there is

[Tutor] xml parsing without a root element

2011-08-30 Thread rail shafigulin
hello everyone. i need to parse a an xml-like file. the problem that i'm facing is that this file doesn't have the root element but in all other terms it is the same as xml, i.e does anybody know if there is a module in python that allows to process an xml file without a root element? i t

Re: [Tutor] XML parsing with SAX

2008-10-22 Thread Kent Johnson
On Wed, Oct 22, 2008 at 9:07 AM, amit sethi <[EMAIL PROTECTED]> wrote: > Sorry , I didn't follow the format of posting to the group. Well I am new to > xml and python . What I basically want to do is to read elements from the > xml which is by the way large ~2GB and read the attributes and make a >

Re: [Tutor] XML parsing with SAX

2008-10-22 Thread A.T.Hofkamp
amit sethi wrote: Sorry , I didn't follow the format of posting to the group. Well I am new to xml and python . What I basically want to do is to read elements from the xml which is by the way large ~2GB and read the attributes and make a decision as to whether i want to keep that element or not

[Tutor] XML parsing with SAX

2008-10-22 Thread amit sethi
Sorry , I didn't follow the format of posting to the group. Well I am new to xml and python . What I basically want to do is to read elements from the xml which is by the way large ~2GB and read the attributes and make a decision as to whether i want to keep that element or not . I am told that xml

[Tutor] XML parsing with SAX was Re: (no subject)

2008-10-22 Thread Alan Gauld
"amit sethi" <[EMAIL PROTECTED]> wrote Please, always use a meaningful subject line when posting! and do not reply to an existing thread, changing the subject. These things mess up threaded reading tools such as gmane and newsreaders. This reduces your chances of a reply. Hi can any body give me

Re: [Tutor] xml parsing

2007-10-02 Thread Alan Gauld
"chinni" <[EMAIL PROTECTED]> wrote > I am working on MAC and my App was based on Xml file.If any updates > r any > changes in the xml file my app will load that changes. > as i am new to python.i want to automate that one. > details snipped > Here the size is in KB's.Now plz tell me how to

[Tutor] xml parsing

2007-10-02 Thread chinni
Hi, I am working on MAC and my App was based on Xml file.If any updates r any changes in the xml file my app will load that changes. as i am new to python.i want to automate that one. there will be one URL and size will mention in that Xml file.i want to write a script so that it will download the

Re: [Tutor] XML parsing in Python.. resources needed

2006-10-27 Thread Gabriel Farrell
On Fri, Oct 27, 2006 at 11:24:00AM +0100, Asrarahmed Kadri wrote: > Hi Folks, > > ANy comments about ELementTree module... > > I have heard that it is more 'Pythonic'... > > I need some basic examples to start learning the stuff.. If anyone has got > the information, please pass it along.. > E

Re: [Tutor] XML parsing in Python.. resources needed

2006-10-27 Thread Kent Johnson
Asrarahmed Kadri wrote: > > > Hi Folks, > > ANy comments about ELementTree module... > > I have heard that it is more 'Pythonic'... > > I need some basic examples to start learning the stuff.. If anyone has > got the information, please pass it along.. http://effbot.org/zone/element.htm

[Tutor] XML parsing in Python.. resources needed

2006-10-27 Thread Asrarahmed Kadri
    Hi Folks,   ANy comments about ELementTree module...   I have heard that it is more 'Pythonic'...   I need some basic examples to start learning the stuff.. If anyone has got the information, please pass it along..   Thanks.   Regards, Asrarahmed Kadri-- To HIM you shall return. _

Re: [Tutor] XML Parsing Woes.

2006-05-31 Thread Kent Johnson
doug shawhan wrote: > Having been dragged kicking and screaming into the fussy, fussy world of > XML, I find myself in a pickle. > > I keep getting an error complaining of a missing end-tag: > > : XML Parse error. > XML Error Text: "; nested exception is: > org.xml.sax.SAXParseException

[Tutor] XML Parsing Woes.

2006-05-31 Thread doug shawhan
Having been dragged kicking and screaming into the fussy, fussy world of XML, I find myself in a pickle. I keep getting an error complaining of a missing end-tag:  : XML Parse error. XML Error Text: "; nested exception is:     org.xml.sax.SAXParseException: The element type "Description" mus