Re: [Tutor] XML Programs

2018-04-21 Thread Albert-Jan Roskam
On Apr 21, 2018 09:06, Peter Otten <__pete...@web.de> wrote: > > Glen wrote: > > > Thank you for your comprehensive reply. It was very helpful! > > Just to clarify one point, is it not possible to search for a node > > directly in the element / elementTree or do you first need to pull the > > data

Re: [Tutor] XML Programs

2018-04-21 Thread Peter Otten
Glen wrote: > Thank you for your comprehensive reply. It was very helpful! > Just to clarify one point, is it not possible to search for a node > directly in the element / elementTree or do you first need to pull the > data into a class/dict? You certainly have other options >>> catalog.xpath("/

Re: [Tutor] XML Programs

2018-04-19 Thread Peter Otten
Glen wrote: > Hey guys, > > I have the following code: > > https://repl.it/@glendog/HurtfulPunctualInterface from lxml import etree catalog = etree.parse("example.xml") def getbooks(xmldata): books = xmldata.xpath("//catalog")[0] for item in books: print(item.findtext("title")

Re: [Tutor] XML Programs

2018-04-19 Thread Glen
Hey guys, I have the following code: https://repl.it/@glendog/HurtfulPunctualInterface Using the function I have define I can print to screen a list of books. However, how can I search for records within the xml using an ID or the title of the book etc? I've tried reading the tutorial but the pe

Re: [Tutor] XML Programs

2018-04-18 Thread Glen
Hello Stefan, Thank you for this. That's actually quite helpful! Regards, On 17 April 2018 at 19:56, Stefan Behnel wrote: > Glen schrieb am 16.04.2018 um 13:10: > > I'm writing a save-game editor for a game I play (just a project to > learn). > > But I am struggling on how to structure the cod

Re: [Tutor] XML Programs

2018-04-17 Thread Stefan Behnel
Glen schrieb am 16.04.2018 um 13:10: > I'm writing a save-game editor for a game I play (just a project to learn). > But I am struggling on how to structure the code, how to store the xml data > in data structure etc, > > Can anyone recommend some source I can review that reads and writes data > f

Re: [Tutor] XML Programs

2018-04-17 Thread Stefan Behnel
leam hall schrieb am 16.04.2018 um 14:54: > On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote: >> I'm writing a save-game editor for a game I play (just a project to learn). >> But I am struggling on how to structure the code, how to store the xml data >> in data structure etc, >> >> Can anyone recommend

Re: [Tutor] XML Programs

2018-04-16 Thread George Fischhof
Hi, Maybe you should give a try to xmltodict package George leam hall ezt írta (időpont: 2018. ápr. 16., H 15:14): > Yeah, understood. > > Okay, knowing that others are smarter about python, and ElementTree, > here's some code I was using to parse XML. Took a while to recover > from. :) > > L

Re: [Tutor] XML Programs

2018-04-16 Thread leam hall
Yeah, understood. Okay, knowing that others are smarter about python, and ElementTree, here's some code I was using to parse XML. Took a while to recover from. :) Leam # import xml.etree.ElementTree as ET import os import argparse import fnmatch def show_info(file, element): action

Re: [Tutor] XML Programs

2018-04-16 Thread Glen
I understand, I'd love to use something else but the save game files are in XML so I have no choice :'( On 16 April 2018 at 13:54, leam hall wrote: > On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote: > > Hey guys, > > > > I'm writing a save-game editor for a game I play (just a project to > learn).

Re: [Tutor] XML Programs

2018-04-16 Thread leam hall
On Mon, Apr 16, 2018 at 7:10 AM, Glen wrote: > Hey guys, > > I'm writing a save-game editor for a game I play (just a project to learn). > But I am struggling on how to structure the code, how to store the xml data > in data structure etc, > > Can anyone recommend some source I can review that rea

[Tutor] XML Programs

2018-04-16 Thread Glen
Hey guys, I'm writing a save-game editor for a game I play (just a project to learn). But I am struggling on how to structure the code, how to store the xml data in data structure etc, Can anyone recommend some source I can review that reads and writes data from an xml file. Thanks,

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 and ElementTree

2016-04-26 Thread Alan Gauld via Tutor
Forwarding to tutor list. Please always use "Reply All" or "Reply List" when responding to the tutor list. On 26/04/16 09:24, Marco Soldavini wrote: > On Tue, Apr 26, 2016 at 2:05 AM, Alan Gauld via Tutor > wrote: >> On 25/04/16 17:24, Marco Soldavini wrote: >>> I've a few questions about parsin

Re: [Tutor] XML and ElementTree

2016-04-25 Thread Alan Gauld via Tutor
On 25/04/16 17:24, Marco Soldavini wrote: > I've a few questions about parsing XML. I wrote some code that works > but I want to know which are the most intelligent data structures to > parse data to Answer: The ones that suit what you want to do with it. But you haven't told us what you plan on u

[Tutor] XML and ElementTree

2016-04-25 Thread Marco Soldavini
I've a few questions about parsing XML. I wrote some code that works but I want to know which are the most intelligent data structures to parse data to Consider that my XML file is something like the following: 1 XXX .

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 question

2010-07-27 Thread Albert-Jan Roskam
ever done for us? ~~ --- On Tue, 7/27/10, Mac Ryan wrote: From: Mac Ryan Subject: Re: [Tutor] xml question To: tutor@python.org Date: Tuesday, July 27, 2010, 11:46 AM On Mon, 2010-07-26 at 12:09 -0700, Albert-Jan Roskam wro

Re: [Tutor] xml question

2010-07-27 Thread Andreas Röhler
Am 27.07.2010 02:29, schrieb Steven D'Aprano: On Tue, 27 Jul 2010 05:09:09 am Albert-Jan Roskam wrote: Hi, I am making a data processing program that will use a configuration file. The file should contain information about: (1) source files used, (2) (intermediate) output files, (3) used pa

Re: [Tutor] xml question

2010-07-27 Thread Mac Ryan
On Mon, 2010-07-26 at 12:09 -0700, Albert-Jan Roskam wrote: > I am making a data processing program that will use a configuration > file. The file should contain information about: (1) source files > used, (2) (intermediate) output files, (3) used parameters/estimation > methods (4) manual data edi

Re: [Tutor] xml question

2010-07-26 Thread davidheiserca
I agree with Steven D'Aprano. Keep the code as simple as possible. A simple text file with a variable/value pair on each line is very easy to parse and store in a Dictionary object. You can use any convenient delimiter; "=", ":", "$", ... Nesting items under categories takes just a little mo

Re: [Tutor] xml question

2010-07-26 Thread Steven D'Aprano
On Tue, 27 Jul 2010 05:09:09 am Albert-Jan Roskam wrote: > Hi, > > I am making a data processing program that will use a configuration > file. The file should contain information about: (1) source files > used, (2) (intermediate) output files, (3) used parameters/estimation > methods (4) manual dat

Re: [Tutor] xml question

2010-07-26 Thread Alan Gauld
"Albert-Jan Roskam" wrote The file should contain information about: ... (4) manual data edits + datetime stamp + user name . I'd like to store this config file in xml. Sounds sensible to me. ... what would the elementtree look like? Should I just use 'config' or something similar as root

Re: [Tutor] xml question

2010-07-26 Thread Alan Gauld
"Joel Goldstick" wrote I am making a data processing program that will use a configuration file. The file should contain information about: (1) source files used, (2) (intermediate) output files, (3) used parameters/estimation methods (4) manual data edits + datetime stamp + user name . I'd

Re: [Tutor] xml question

2010-07-26 Thread Joel Goldstick
On Mon, Jul 26, 2010 at 3:09 PM, Albert-Jan Roskam wrote: > Hi, > > I am making a data processing program that will use a configuration file. > The file should contain information about: (1) source files used, (2) > (intermediate) output files, (3) used parameters/estimation methods (4) > manual

[Tutor] xml question

2010-07-26 Thread Albert-Jan Roskam
Hi, I am making a data processing program that will use a configuration file. The file should contain information about: (1) source files used, (2) (intermediate) output files, (3) used parameters/estimation methods (4) manual data edits + datetime stamp + user name . I'd like to store this con

Re: [Tutor] XML: changing value of elements and writing to a file

2009-07-16 Thread Stefan Behnel
Johan Geldenhuys wrote: > Thanks Stefan (decided to continue with a new thread name), ... which isn't quite enough. As long as you reply to the mail, e-mail/news readers will still sort it into the original thread, so many people will not see it. > I basically wants to create a loop that creates

[Tutor] XML: changing value of elements and writing to a file

2009-07-16 Thread Johan Geldenhuys
l Message- From: tutor-bounces+johan=accesstel.com...@python.org [mailto:tutor-bounces+johan=accesstel.com...@python.org] On Behalf Of Stefan Behnel Sent: Thursday, July 16, 2009 7:23 PM To: tutor@python.org Subject: Re: [Tutor] XML: changing value of elements Hi, a new question usually merits a

Re: [Tutor] XML: changing value of elements

2009-07-16 Thread Stefan Behnel
Hi, a new question usually merits a new thread. Especially after a longer time, replies to older threads tend to remain unread as people simply don't scroll down far enough to notice them. You were lucky. :) Johan Geldenhuys wrote: > I have another question about writing the xml tree to a file.

Re: [Tutor] XML: changing value of elements

2009-07-15 Thread Johan Geldenhuys
hat to one xml file? Thanks Johan -Original Message- From: tutor-bounces+johan=accesstel.com...@python.org [mailto:tutor-bounces+johan=accesstel.com...@python.org] On Behalf Of Stefan Behnel Sent: Thursday, June 11, 2009 4:37 PM To: tutor@python.org Subject: Re: [Tutor] XML: changing value of element

Re: [Tutor] XML: changing value of elements

2009-06-11 Thread Johan Geldenhuys
ow it goes. Thanks Johan -Original Message- From: tutor-bounces+johan=accesstel.com...@python.org [mailto:tutor-bounces+johan=accesstel.com...@python.org] On Behalf Of Stefan Behnel Sent: Thursday, 11 June 2009 16:37 PM To: tutor@python.org Subject: Re: [Tutor] XML: changing value of ele

Re: [Tutor] XML: changing value of elements

2009-06-10 Thread Stefan Behnel
Hi, it's funny how many times I see Python users go: "I have an XML problem, so I'll use minidom." Because then they have two problems. Johan Geldenhuys wrote: > I have a rather complex XML file and I need to change some values inside > this file. > > So far I have been using minidom, but I can

[Tutor] XML: changing value of elements

2009-06-09 Thread Johan Geldenhuys
Hi all, I have a rather complex XML file and I need to change some values inside this file. So far I have been using minidom, but I can't find the thing I am looking for. My code so far: """ from xml.dom import minidom xmlFile = 'signal1.xml' xmlDocument = minidom.parse(xmlFile)

Re: [Tutor] XML to text

2008-10-24 Thread Dinesh B Vadhia
Yes, that's exactly what I was looking for. Brilliant! From: Kent Johnson Sent: Friday, October 24, 2008 10:59 AM To: Dinesh B Vadhia Cc: tutor@python.org Subject: Re: [Tutor] XML to text On Fri, Oct 24, 2008 at 11:54 AM, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > I have

Re: [Tutor] XML to text

2008-10-24 Thread Kent Johnson
On Fri, Oct 24, 2008 at 11:54 AM, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > I have a large number of xml files that I want to convert into text format. > What is the best and easiest way to do this? Thanks! If by "convert into text format" you mean, strip all the xml markup and leave just the

Re: [Tutor] XML to text

2008-10-24 Thread Thomas Walch
This might be helpful: http://www.boddie.org.uk/python/XML_intro.html Have fun! Thomas Dinesh B Vadhia schrieb: I have a large number of xml files that I want to convert into text format. What is the best and easiest way to do this? Thanks! Dinesh ---

[Tutor] XML to text

2008-10-24 Thread Dinesh B Vadhia
I have a large number of xml files that I want to convert into text format. What is the best and easiest way to do this? Thanks! Dinesh ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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 data reading [slightly off topic/silly]

2007-12-20 Thread Eric Walstad
Lockhart, Luke wrote: > ...now I'm a > Linux man and trying to realize my overly ambitious programming dreams > with Python Welcome to the real world, Neo. I'm not saying that you'll be able to work with XML via DOM or SAX in Python. I'm saying that when you are ready, you won't have to. :) (

Re: [Tutor] XML data reading

2007-12-20 Thread Michael Langford
Sax is the simplest to get started with. here is a simple example. See http://docs.python.org/lib/content-handler-objects.html for more info on the methods of ContentHandler. Using some list or dict of tags you're processing such as I do in the following example will keep "tag specific code" down t

Re: [Tutor] XML

2007-12-20 Thread Kent Johnson
Lockhart, Luke wrote: > Now, the program I'm working on would hypothetically store and read all > data as XML, and yes I'm aware of the performance drawbacks and I'm > willing to live with them. But I just can't figure out the various > libraries that Python uses to read XML, and my friend's cod

[Tutor] XML

2007-12-20 Thread Lockhart, Luke
Hello all, Sorry if this is a double post, I had some technical problems with subscribing to this list. So I'm a very novice Python programmer. I've done stuff up to the intermediate level in Microsoft flavors of BASIC and C++, but now I'm a Linux man and trying to realize my overly ambitiou

[Tutor] XML data reading

2007-12-20 Thread Lockhart, Luke
Hello all, So I'm a very novice Python programmer. I've done stuff up to the intermediate level in Microsoft flavors of BASIC and C++, but now I'm a Linux man and trying to realize my overly ambitious programming dreams with Python, mainly because I have friends who use it and because it has l

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 reference

2007-09-19 Thread O.R.Senthil Kumaran
> > Which Book is better for python parsing and reading Xml files from > > local > > machine and remote machine and also through http... > > Python Network Programming has more on the networking > side(surprise!) via http. You mean, this one. http://www.complete.org/publications/pynet/ ? > >

Re: [Tutor] Xml reference

2007-09-17 Thread Alan Gauld
"chinni" <[EMAIL PROTECTED]> wrote > Which Book is better for python parsing and reading Xml files from > local > machine and remote machine and also through http... A lot depends on which parser you are using. David Metz "Text Processing in Python" is a good general text on parsing, including

Re: [Tutor] Xml reference

2007-09-17 Thread Michael Langford
I've found Python Cookbook to be a good, modern resource for parsing as well as tricks for remote pages. Link at amazon: *http://tinyurl.com/2njsd9 --Michael Original url: http://www.amazon.com/gp/product/0596007973/102-1641864-7294551?ie=UTF8&tag=rowlab-20&linkCode=xm2&camp=1789&creati

[Tutor] Xml reference

2007-09-17 Thread chinni
Hi all, Which Book is better for python parsing and reading Xml files from local machine and remote machine and also through http... Can any one Please Post the link at least ...waiting for u r Replies . Thanku:) -- Cheers, M.Srikanth Kumar, Phone no: +91-9866774007

Re: [Tutor] XML-RPC data transfers.

2007-01-11 Thread Hugo González Monteverde
Luke Paireepinart wrote: > But the main strategy is to get the data out of the ImageGrab object. > one way is stated above - use the save method to write to a file. > another possible way is to create a filelike class, implementing 'tell' > 'seek' and 'write' methods, that just collects all the

Re: [Tutor] XML-RPC data transfers.

2007-01-01 Thread Chris Hengge
The main reason I haven't posted to more then one list is because I'm trying to avoid looking obnoxious, as well as getting redundant information, or having to keep answering the same things mutliple times... I might ask this over there though after I try a few more things. Thanks. On 1/1/07, Tim

Re: [Tutor] XML-RPC data transfers.

2007-01-01 Thread Ziad Rahhal
Did you look at SOAPpy? if you are interested in doing what you want to do through web-services, then SOAPpy might be what you are looking for. It does support XML-RPC. I have developed a working example that sends an image from a Java Web-service and receives the image at a SOAPpy client that use

Re: [Tutor] XML-RPC data transfers.

2007-01-01 Thread Tim Golden
Chris Hengge wrote: > Going off your thoughts that I'm asking to do something outside the > realm of the readers here, is there a better place to ask this kind of > oddball stuff? I've looked around and haven't been able to find any > support for XML-RPC (might be a good sign to drop it and move

Re: [Tutor] XML-RPC data transfers.

2007-01-01 Thread Alan Gauld
"Chris Hengge" <[EMAIL PROTECTED]> wrote > Going off your thoughts that I'm asking to do something outside the > realm of > the readers here, is there a better place to ask this kind of > oddball stuff? > I've looked around and haven't been able to find any support for > XML-RPC I'd try the XM

Re: [Tutor] XML-RPC data transfers.

2006-12-31 Thread Chris Hengge
Boo bloatware! Don't even mention those... heheh.. I even turn off most the services on my system to keep things clean.. But thats another story.. Going off your thoughts that I'm asking to do something outside the realm of the readers here, is there a better place to ask this kind of oddball stu

Re: [Tutor] XML-RPC data transfers.

2006-12-31 Thread Alan Gauld
"Chris Hengge" <[EMAIL PROTECTED]> wrote > method is a good one. Much like your own answers to most of my > questions, > you state several ways varying from "probably works" to "how I'd try > to do > it". Personally, I'd rather understand more of the "how I know it > works" One reason may be t

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Kent Johnson
Luke Paireepinart wrote: > But the main strategy is to get the data out of the ImageGrab object. > one way is stated above - use the save method to write to a file. > another possible way is to create a filelike class, implementing 'tell' > 'seek' and 'write' methods, that just collects all the d

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Kent Johnson
Chris Hengge wrote: > if I'm trying to transmit a 'file' that is actually saved on the HD, the > code from the link in my first post works fine (reading in the file > using binary mode access). My problem is that I'm trying to figure out > how to transfer data that isn't yet saved to the drive,

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Chris Hengge
First off, thanks for the info luke, I'll give these idea's a shot. Second, I fully understand the wow factor from figuring out stuff on my own, but I also work fulltime and attend roughly 20 credits of college a term, while taking care of my family/homelife and this xmas break is one of the few c

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Luke Paireepinart
Chris Hengge wrote: > This works... > d = xmlrpclib.Binary(open("C:\\somefile.exe", "rb").read()) > > What I need is more like > screenShot = ImageGrab.Grab() > d = xmlrpclib.Binary(screenShot) because screenShot is not binary data. It's an instance of the class Image.

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Luke Paireepinart
Chris Hengge wrote: > if I'm trying to transmit a 'file' that is actually saved on the HD, > the code from the link in my first post works fine (reading in the > file using binary mode access). My problem is that I'm trying to > figure out how to transfer data that isn't yet saved to the drive,

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Chris Hengge
This works... d = xmlrpclib.Binary(open("C:\\somefile.exe", "rb").read()) What I need is more like screenShot = ImageGrab.Grab() d = xmlrpclib.Binary(screenShot) This doesn't work though. On 12/30/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote: > I might have been unclear, or

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Chris Hengge
if I'm trying to transmit a 'file' that is actually saved on the HD, the code from the link in my first post works fine (reading in the file using binary mode access). My problem is that I'm trying to figure out how to transfer data that isn't yet saved to the drive, because I'm wanting to be able

Re: [Tutor] XML-RPC data transfers.

2006-12-30 Thread Kent Johnson
Chris Hengge wrote: > I might have been unclear, or this tid-bit might have been lost in the > thread... but I'm trying to send directly from ImageGrab.Grab(), without > saving the data as a file. Thats where I'm getting hung... If it try to > send an actual stored file, I have no problem. Is th

Re: [Tutor] XML-RPC data transfers.

2006-12-29 Thread Chris Hengge
I might have been unclear, or this tid-bit might have been lost in the thread... but I'm trying to send directly from ImageGrab.Grab(), without saving the data as a file. Thats where I'm getting hung... If it try to send an actual stored file, I have no problem. Is this maybe impossible? My though

  1   2   >