Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Karim
2) http://stackoverflow.com/questions/7802418/how-to-properly-escape-single-and-double-quotes 3)http://stackoverflow.com/questions/4972210/escaping-characters-in-a-xml-file-with-python Here is the data (in CSV format) and script, respectively, (I have tried v

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Saran Ahluwalia
h-python >> >> >> Here is the data (in CSV format) and script, respectively, (I have tried >> variations on serializing Column 'E' using both Sax and ElementTree): >> >> i) >> >> A,B,C,D,E,F,G,H,I,J >> "3","8"

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Saran Ahluwalia
stions/7802418/how-to-properly-escape-single-and-double-quotes >> >> 3) >> http://stackoverflow.com/questions/4972210/escaping-characters-in-a-xml-file-with-python >> >> >> Here is the data (in CSV format) and script, respectively, (I have tried >> varia

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Karim
-quotes 3)http://stackoverflow.com/questions/4972210/escaping-characters-in-a-xml-file-with-python Here is the data (in CSV format) and script, respectively, (I have tried variations on serializing Column 'E' using both Sax and ElementTree): i) A,B,C,D,E,F,G,H,I,J "3","8

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Karim
-quotes 3)http://stackoverflow.com/questions/4972210/escaping-characters-in-a-xml-file-with-python Here is the data (in CSV format) and script, respectively, (I have tried variations on serializing Column 'E' using both Sax and ElementTree): i) A,B,C,D,E,F,G,H,I,J "3","8

Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread kbtyo
/questions/4972210/escaping-characters-in-a-xml-file-with-python Here is the data (in CSV format) and script, respectively, (I have tried variations on serializing Column 'E' using both Sax and ElementTree): i) A,B,C,D,E,F,G,H,I,J "3","8","1","2312285SC

Re: Help with ElementTree

2015-04-09 Thread Larry Martell
within XML documents > is the XPath query language. ElementTree has limited support for it > https://docs.python.org/3/library/xml.etree.elementtree.html#elementtree-xpath>, > enough for your stated requirements. > >> I would like to use ElementTree to get 2 values from this: >

Re: Help with ElementTree

2015-04-09 Thread Larry Martell
>> >> >> KA21 >> KA21 >> >> >> >> >> >> >> >> >>00:00:00 &

Re: Help with ElementTree

2015-04-09 Thread Ben Finney
pointlessly force you to use mixed case, when the convention is to name all the elements in lowercase (‘parameter’, ‘current’, etc.). That said: What you need for this kind of searching within XML documents is the XPath query language. ElementTree has limited support for it https://docs.python.or

Re: Help with ElementTree

2015-04-09 Thread Peter Otten
KA21 > KA21 > > > > > > > > >00:00:00 >15/03/2014 05:56:00 > > > > > > > I would like to use ElementTree to get 2 values from this: > > SystemConfig.Environment

Help with ElementTree

2015-04-09 Thread Larry Martell
:00 I would like to use ElementTree to get 2 values from this: SystemConfig.Environment.ToolName.Current Events.LastEventExportTime.Current I've been trying for hours to get ElementTree to give me these 2 values, but nothing I do seems to work. Can anyone help me

Re: insert html into ElementTree without parsing it

2014-03-01 Thread Stefan Behnel
graeme.piete...@gmail.com, 24.02.2014 10:45: > I am building HTML pages using ElementTree. > I need to insert chunks of untrusted HTML into the page. I do not need or > want to parse this, just insert it at a particular point as is. How would you want to find out if it can be safely in

insert html into ElementTree without parsing it

2014-02-24 Thread graeme . pietersz
I am building HTML pages using ElementTree. I need to insert chunks of untrusted HTML into the page. I do not need or want to parse this, just insert it at a particular point as is. The best solutions I can think of are rather ugly ones: manipulating the string created by tostring. Is there a

simple ElementTree based parser that allows entity definition map

2013-12-04 Thread Robin Becker
I'm tasked with writing a 'simple' ElementTree based parser with support for unknown entities eg &foo;. This code derived from FL's old documentation fails in both python 2 and 3. import xml.etree.ElementTree as ET try: ascii except: fro

Re: parsing nested unbounded XML fields with ElementTree

2013-11-27 Thread Larry Martell
On Tue, Nov 26, 2013 at 8:20 AM, Stefan Behnel wrote: > Larry Martell, 26.11.2013 13:23: >> On Tue, Nov 26, 2013 at 2:38 AM, Stefan Behnel wrote: >>> larry.martell...@gmail.com, 25.11.2013 23:22: I have an XML file that has an element called "Node". These can be nested to any depth and

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Neil Cerutti
e, if the XML file had: > > > > > > > > When I'm parsing Node "E" I need to know I'm in A/B/C/D/E. > Problem is I don't know how deep this can be. This is the code > I have so far: I also an ElementTree user, but it&

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Stefan Behnel
Larry Martell, 26.11.2013 13:23: > On Tue, Nov 26, 2013 at 2:38 AM, Stefan Behnel wrote: >> larry.martell...@gmail.com, 25.11.2013 23:22: >>> I have an XML file that has an element called "Node". These can be nested >>> to any depth and the depth of the nesting is not known to me. I need to >>> p

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread alister
On 26/11/13 11:59, Larry Martell wrote: On Tue, Nov 26, 2013 at 5:41 AM, Alister wrote: On Mon, 25 Nov 2013 18:25:55 -0500, Larry Martell wrote: On Mon, Nov 25, 2013 at 6:19 PM, Chris Angelico wrote: On Tue, Nov 26, 2013 at 9:45 AM, Larry Martell wrote: On Monday, November 25, 2013 5:30:

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Larry Martell
append() at the beginning of the function > and pop() at the end, i.e. a stack. That list will then always give you the > current path from the root node. Thanks for the reply. How can I remove getiterator()? Then I won't be traversing the nodes of the tree. I can't iterate over tree.

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Chris Angelico
On Tue, Nov 26, 2013 at 10:59 PM, Larry Martell wrote: > Sorry, didn't realize it was sending in HMTL. I had it set to plain > text, but when the awful gmail update came out it seems to have > reverted to HTML. Hopefully this is better. Yeah, I have the same trouble... but yes, this post looks fi

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Larry Martell
On Tue, Nov 26, 2013 at 5:41 AM, Alister wrote: > > On Mon, 25 Nov 2013 18:25:55 -0500, Larry Martell wrote: > > > On Mon, Nov 25, 2013 at 6:19 PM, Chris Angelico > > wrote: > > > >> On Tue, Nov 26, 2013 at 9:45 AM, Larry Martell > >> > >> wrote: > >> > On Monday, November 25, 2013 5:30:44 PM UT

Re: parsing nested unbounded XML fields with ElementTree

2013-11-26 Thread Alister
On Mon, 25 Nov 2013 18:25:55 -0500, Larry Martell wrote: > On Mon, Nov 25, 2013 at 6:19 PM, Chris Angelico > wrote: > >> On Tue, Nov 26, 2013 at 9:45 AM, Larry Martell >> >> wrote: >> > On Monday, November 25, 2013 5:30:44 PM UTC-5, Chris Angelico wrote: >> > >> >> First off, please clarify: Ar

Re: parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread Stefan Behnel
mply pass down a list of element names that you append() at the beginning of the function and pop() at the end, i.e. a stack. That list will then always give you the current path from the root node. Alternatively, if you want to use lxml.etree instead of ElementTree, you can use it's iterwal

Re: parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread Larry Martell
On Mon, Nov 25, 2013 at 6:19 PM, Chris Angelico wrote: > On Tue, Nov 26, 2013 at 9:45 AM, Larry Martell > wrote: > > On Monday, November 25, 2013 5:30:44 PM UTC-5, Chris Angelico wrote: > > > >> First off, please clarify: Are there five corresponding tags > >> later on? If not, it's not XML, an

Re: parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread Chris Angelico
On Tue, Nov 26, 2013 at 9:45 AM, Larry Martell wrote: > On Monday, November 25, 2013 5:30:44 PM UTC-5, Chris Angelico wrote: > >> First off, please clarify: Are there five corresponding tags >> later on? If not, it's not XML, and nesting will have to be defined >> some other way. > > Yes, there a

Re: parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread Larry Martell
On Monday, November 25, 2013 5:30:44 PM UTC-5, Chris Angelico wrote: > On Tue, Nov 26, 2013 at 9:22 AM, larry.mart...@gmail.com > > wrote: > > > I have an XML file that has an element called "Node". These can be nested > > to any depth and the depth of the nesting is not known to me. I need to

Re: parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread Chris Angelico
On Tue, Nov 26, 2013 at 9:22 AM, larry.mart...@gmail.com wrote: > I have an XML file that has an element called "Node". These can be nested to > any depth and the depth of the nesting is not known to me. I need to parse > the file and preserve the nesting. For exmaple, if the XML file had: > >

parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread larry.mart...@gmail.com
I have an XML file that has an element called "Node". These can be nested to any depth and the depth of the nesting is not known to me. I need to parse the file and preserve the nesting. For exmaple, if the XML file had: When I'm parsing Node "E" I need to know I

Re: ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread fronagzen
ank you all! > > > > I was a little apprehensive it could be a silly mistake. And so it was. > > I have BeautifulSoup somewhere. Having had no urgent need for it I > > remember shirking the learning curve. > > > > lxml seems to be a package with the

Re: ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread F.R.
On 07/11/2013 10:59 AM, F.R. wrote: Hi all, I haven't been able to get up to speed with XML. I do examples from the tutorials and experiment with variations. Time and time again I fail with errors messages I can't make sense of. Here's the latest one. The url is "http://finance.yahoo.com/q?s=

Re: ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread Fábio Santos
On 11 Jul 2013 10:24, wrote: > > Actually, I don't think etree has a HTML parser. And I would counter-recommend lxml if speed is an issue: BeautifulSoup takes a long time to parse a large document. > > On Thursday, July 11, 2013 5:08:04 PM UTC+8, Fábio Santos wrote: > > > > Use an HTML parser.

Re: ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread fronagzen
Actually, I don't think etree has a HTML parser. And I would counter-recommend lxml if speed is an issue: BeautifulSoup takes a long time to parse a large document. On Thursday, July 11, 2013 5:08:04 PM UTC+8, Fábio Santos wrote: > On 11 Jul 2013 10:04, "F.R." wrote: > > > > > > Hi all, >

Re: ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread Fábio Santos
On 11 Jul 2013 10:04, "F.R." wrote: > > Hi all, > > I haven't been able to get up to speed with XML. I do examples from the tutorials and experiment with variations. Time and time again I fail with errors messages I can't make sense of. Here's the latest one. The url is " http://finance.yahoo.com/

ElementTree: can't figure out a mismached-tag error

2013-07-11 Thread F.R.
Hi all, I haven't been able to get up to speed with XML. I do examples from the tutorials and experiment with variations. Time and time again I fail with errors messages I can't make sense of. Here's the latest one. The url is "http://finance.yahoo.com/q?s=XIDEQ&ql=0";. Ubuntu 12.04 LTS, Pyth

XML to PDF book with ElementTree and xtopdf

2013-06-15 Thread vasudevram
Hi list, This may be of interest - a program to create simple PDF books from XML text content: Create PDF books with XMLtoPDFBook: http://jugad2.blogspot.in/2013/06/create-pdf-books-with-xmltopdfbook.html XMLtoPDFBook.py requires ElementTree (which is in the standard Python library), xtopdf

Re: Create xml with elementtree ET and xml escaping

2012-12-15 Thread Stefan Behnel
nenad.ci...@gmail.com, 12.12.2012 03:19: > Il giorno martedì 11 dicembre 2012 20:59:54 UTC+1, MRAB ha scritto: >> >>> Since I have also the need to sign the XML I need the ability to create xml >>> but without xml escaping (unescaped data are signed). >> >> XML with the escaping isn't valid XML. >

Re: Create xml with elementtree ET and xml escaping

2012-12-11 Thread nenad . cikic
. Xml is not too difficult so I thought to create > > it manually using ElementTree. > > > First I noted that ET.toString does escape <>& but not " and ' > > > Is that normal? > > > > > " needs to be encoded when it's in an

Re: Create xml with elementtree ET and xml escaping

2012-12-11 Thread MRAB
On 2012-12-11 17:47, nenad.ci...@gmail.com wrote: Hello, I have posted the same in XML group but it seems pretty dead there so I will repost here. I am new to xml processing in python. I am looking to create XML. Xml is not too difficult so I thought to create it manually using ElementTree

Create xml with elementtree ET and xml escaping

2012-12-11 Thread nenad . cikic
Hello, I have posted the same in XML group but it seems pretty dead there so I will repost here. I am new to xml processing in python. I am looking to create XML. Xml is not too difficult so I thought to create it manually using ElementTree. First I noted that ET.toString does escape <>

Re: ElementTree Issue - Search and remove elements

2012-10-17 Thread Stefan Behnel
Alain Ketterlin, 17.10.2012 08:25: > It looks like you can't get the parent of an Element with elementtree (I > would love to be proven wrong on this). No, that's by design. ElementTree allows you to reuse subtrees in a document, for example, which wouldn't work if you enf

Re: ElementTree Issue - Search and remove elements

2012-10-16 Thread Alain Ketterlin
Tharanga Abeyseela writes: > I need to remove the parent node, if a particular match found. It looks like you can't get the parent of an Element with elementtree (I would love to be proven wrong on this). The solution is to find all nodes that have a Rating (grand-) child, and t

Re: ElementTree Issue - Search and remove elements

2012-10-16 Thread Stefan Behnel
Hi, note that it's best to reply to responses you get, rather than starting a new thread on the same topic. It helps in building up context and in keeping details together at one point in the archive for users who run into similar problems later. Tharanga Abeyseela, 17.10.2012 07:47: > I need to

Re: Getting involved - Jython ElementTree performance

2012-01-07 Thread Stefan Behnel
Sophie Sperner, 07.01.2012 13:01: > On Jan 7, 11:53 am, Stefan Behnel wrote: >> A big issue that I have with Jython is that its ElementTree XML parser >> support is so increadibly slow. It could seriously benefit from a better >> integration between the Java XML support i

Re: xml, minidom, ElementTree

2011-12-14 Thread Paul Rudin
Ethan Furman writes: > In the near future I will need to parse and rewrite parts of a xml files > created by a third-party program (PrintShopMail, for the curious). > It contains both binary and textual data. > > There has been some strong debate about the merits of minidom v

Re: xml, minidom, ElementTree

2011-12-13 Thread Stefan Behnel
about the merits of minidom vs ElementTree. Recommendations? People's reaction to the DOM interface seem quite varied, with a majority, perhaps, being negative. I personally would look at both enough to understand the basic API model to see where *I* fit. The API is one thing, yes, but there&#

Re: xml, minidom, ElementTree

2011-12-13 Thread Terry Reedy
ElementTree. Recommendations? People's reaction to the DOM interface seem quite varied, with a majority, perhaps, being negative. I personally would look at both enough to understand the basic API model to see where *I* fit. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/p

xml, minidom, ElementTree

2011-12-13 Thread Ethan Furman
In the near future I will need to parse and rewrite parts of a xml files created by a third-party program (PrintShopMail, for the curious). It contains both binary and textual data. There has been some strong debate about the merits of minidom vs ElementTree. Recommendations? ~Ethan~ -- http

Re: xml tree writing with ElementTree; prepends elements with ns0

2011-10-11 Thread Alain Ketterlin
suppress this? > > See http://effbot.org/zone/element-namespaces.htm > > I'm not sure you can define the default namespace (i.e., avoid prefixes > on element names). However, any conformant XML processor should have no > problem with the output of ElementTree. Sorry,

Re: xml tree writing with ElementTree; prepends elements with ns0

2011-10-11 Thread Alain Ketterlin
s.htm I'm not sure you can define the default namespace (i.e., avoid prefixes on element names). However, any conformant XML processor should have no problem with the output of ElementTree. If you're actually producing HTML, then you should say so when calling tostring(), by giving the app

xml tree writing with ElementTree; prepends elements with ns0

2011-10-11 Thread Alex van der Spek
When reading a tree and writing it back to a new file all the elements are prepended with the string ns0: Why is it prepended and how can I suppress this? Thanks, Alex van der Spek -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree XML parsing problem

2011-04-27 Thread Ervin Hegedüs
hello, On Thu, Apr 28, 2011 at 07:57:28AM +0200, Stefan Behnel wrote: > >So, I started change the codepage mark of xml: > > > > - same result > > - same result > > - same result > > You probably changed this in an editor that supports XML and thus > saves the file in the declared encoding. no

Re: ElementTree XML parsing problem

2011-04-27 Thread Stefan Behnel
Hegedüs Ervin, 27.04.2011 21:33: hello, I'm using ElementTree to parse an XML file, but it stops at the second record (id = 002), which contains a non-standard ascii character, ä. Here's the XML: The complaint offered up by the parser is I've checked this xml with

Re: ElementTree XML parsing problem

2011-04-27 Thread Mike
On 4/27/2011 12:24 PM, Neil Cerutti wrote: On 2011-04-27, Mike wrote: I'm using ElementTree to parse an XML file, but it stops at the second record (id = 002), which contains a non-standard ascii character, ?. Here's the XML: The complaint offered up by the parser is

Re: ElementTree XML parsing problem

2011-04-27 Thread Mike
On 4/27/2011 12:33 PM, Hegedüs Ervin wrote: hello, I'm using ElementTree to parse an XML file, but it stops at the second record (id = 002), which contains a non-standard ascii character, ä. Here's the XML: The complaint offered up by the parser is I've checked thi

Re: ElementTree XML parsing problem

2011-04-27 Thread Hegedüs Ervin
hello, > I'm using ElementTree to parse an XML file, but it stops at the > second record (id = 002), which contains a non-standard ascii > character, ä. Here's the XML: > > > > > > > > > > > The complaint offered up by the parser is

Re: ElementTree XML parsing problem

2011-04-27 Thread Philip Semanchuk
On Apr 27, 2011, at 2:26 PM, Mike wrote: > I'm using ElementTree to parse an XML file, but it stops at the second record > (id = 002), which contains a non-standard ascii character, ä. Here's the XML: > > > > > > > > > > > The comp

Re: ElementTree XML parsing problem

2011-04-27 Thread Neil Cerutti
On 2011-04-27, Mike wrote: > I'm using ElementTree to parse an XML file, but it stops at the > second record (id = 002), which contains a non-standard ascii > character, ?. Here's the XML: > > > > > > > > > > > The complaint offered up by the pa

Re: ElementTree XML parsing problem

2011-04-27 Thread Benjamin Kaplan
On Wed, Apr 27, 2011 at 2:26 PM, Mike wrote: > I'm using ElementTree to parse an XML file, but it stops at the second > record (id = 002), which contains a non-standard ascii character, ä. Here's > the XML: > > > > > > > > > > > The

ElementTree XML parsing problem

2011-04-27 Thread Mike
I'm using ElementTree to parse an XML file, but it stops at the second record (id = 002), which contains a non-standard ascii character, ä. Here's the XML: The complaint offered up by the parser is Unexpected error opening simple_fail.xml: not well-formed (invalid toke

Dealing with xml namespaces with ElementTree

2011-01-21 Thread Neil Cerutti
I have to parse many xml documents that senselessly(?) specify a single namespace for the whole document. After a couple of years, my approach has boiled down to the following three little helpers, for use with ElementTree: def insert_namespace(xpath): # Enable *simple* xpath searches by

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Diez B. Roggisch
hackingKK writes: > On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: >> In message, hackingKK >> wrote: >> >> >>> I want to know if there is a way to have the ElementTree module write to >>> an xml file with line breaks?

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Stefan Behnel
hackingKK, 31.10.2010 10:04: On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: hackingKK wrote: Further more, I just was curious why elementtree is not having the namespace facility? ElementTree handles namespaces just fine. So is there a function to generate tags

Re: no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK
On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: In message, hackingKK wrote: I want to know if there is a way to have the ElementTree module write to an xml file with line breaks? Why does it matter? The XML files you generate are not for humans to look at, are

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Lawrence D'Oliveiro
In message , hackingKK wrote: > I want to know if there is a way to have the ElementTree module write to > an xml file with line breaks? Why does it matter? The XML files you generate are not for humans to look at, are they? > Further more, I just was curious why elementtree is not h

no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK
Hello all. I want to know if there is a way to have the ElementTree module write to an xml file with line breaks? I find that when I use the write function from the module on a tree object, the resulting file has no line breaks. I don't want to use prittyprint because it is adding extra

Re: is elementTree really a part of python 2.6?

2010-10-28 Thread Chris Rebert
did not quite like about dom.minidom, so now > trying to use elementTree. > But to my surprise, I could not import xml.elementtree in my default python > 2.6 setup. The module is called xml.etree.ElementTree, *not* xml.elementtree. It's been in Python since v2.5. Cheers, Chris -- h

Re: is elementTree really a part of python 2.6?

2010-10-28 Thread Godson Gera
do the following import xml.etree that imports the elementtree library in 2.5 it self so you sure can do that in 2.6 http://docs.python.org/library/xml.etree.elementtree.html -- Thanks & Regards, Godson Gera Python Consultant India<http://blog.godson.in/2010/09/how-to-make-python-xm

is elementTree really a part of python 2.6?

2010-10-28 Thread hackingKK
Hello all, Some days back I had asked a few questions about parsing xml files using python. I have tryed dom.minidom module but I did not like the prittyPrint way of writing nodes. There were many other things I did not quite like about dom.minidom, so now trying to use elementTree. But to my

Re: ElementTree handling nested tag

2010-10-04 Thread Diez B. Roggisch
en this should help: >> >> >> from xml.etree.ElementTree import * >> >> >> doc = """ >> >> >> >> >> >>       httpRequest >> >>       HTTP://cmd.wma.ibm.com:80/ >> >>       GET >> >>

Re: ElementTree handling nested tag

2010-10-03 Thread tekion
t; >> > >>       httpRequest > >>       HTTP://cmd.wma.ibm.com:80/ > >>       GET > >>       200 > >>     > >> > >> """ > > >> doc = fromstring(doc) > > >> resource_access = doc.find("res

Re: ElementTree handling nested tag

2010-10-03 Thread Diez B. Roggisch
gt;> Then this should help: >> >> from xml.etree.ElementTree import * >> >> doc = """ >> >> >>       httpRequest >>       HTTP://cmd.wma.ibm.com:80/ >>       GET >>       200 >>     >> >> """ &

Re: ElementTree handling nested tag

2010-10-03 Thread tekion
    httpRequest >       HTTP://cmd.wma.ibm.com:80/ >       GET >       200 >     > > """ > > doc = fromstring(doc) > > resource_access = doc.find("resource_access") > print tostring(resource_access) > > Diez Diez, This is the sample forma

Re: ElementTree handling nested tag

2010-10-02 Thread Diez B. Roggisch
tekion writes: > All, > I have the following xml tag: > > > httpRequest > HTTP://cmd.wma.ibm.com:80/ > GET > 200 > > > > I am interested in: >httpRequest > HTTP://cmd.wma.ibm.com:80/ > GET > 200 > as well as the upper layer tag. How do I ge

ElementTree handling nested tag

2010-10-01 Thread tekion
All, I have the following xml tag: httpRequest HTTP://cmd.wma.ibm.com:80/ GET 200 I am interested in: httpRequest HTTP://cmd.wma.ibm.com:80/ GET 200 as well as the upper layer tag. How do I get at the nest tag listed above? Thanks. -- http:

Re: Can't find elements using ElementTree find method

2010-08-31 Thread Brendan Simon (eTRIX)
I can't use getroot() when using fromstring() -- as fromstring() returns an Element, not an ElementTree object. Yes, my root is the 'components' element, but find() seems to insist on searching for sub-elements. Ideally, I would like root.find('components') or root.fin

Re: Can't find elements using ElementTree find method

2010-08-31 Thread Stefan Behnel
Brendan Simon (eTRIX), 31.08.2010 10:49: I am trying to use ElementTree (with Python 2.7) and can't seem to find elements at the top level. The find() and findall() methods seem to find elements within the top level, but not if it the elements are at the top level. How do I find top

Re: Can't find elements using ElementTree find method

2010-08-31 Thread Nitin Pawar
m trying to use ElementTree (with Python 2.7) and can't seem to find > elements at the top level. The find() and findall() methods seem to find > elements within the top level, but not if it the elements are at the top > level. > > How do I find top level elemen

Can't find elements using ElementTree find method

2010-08-31 Thread Brendan Simon (eTRIX)
I am trying to use ElementTree (with Python 2.7) and can't seem to find elements at the top level. The find() and findall() methods seem to find elements within the top level, but not if it the elements are at the top level. How do I find top level elements ?? Here is my code. i

Re: Using elementtree to Create HTML Form / Set "selected"

2010-08-12 Thread Doug
On Aug 12, 10:47 am, Peter Otten <__pete...@web.de> wrote: > Doug wrote: > > I'm using elementtree to create a form. > > > I would like to set the "selected" attribute. > > > Setting using the usual > >  option.set( "selected" =

Re: Using elementtree to Create HTML Form / Set "selected"

2010-08-12 Thread Peter Otten
Doug wrote: > I'm using elementtree to create a form. > > I would like to set the "selected" attribute. > > Setting using the usual > option.set( "selected" = "" ) Maybe that should be option.set(selected="selected"). I th

Using elementtree to Create HTML Form / Set "selected"

2010-08-12 Thread Doug
I'm using elementtree to create a form. I would like to set the "selected" attribute. Setting using the usual option.set( "selected" = "" ) gives me Operations how does one make Operations which is what I need. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is ElementTree development still active?

2010-08-11 Thread Terry Reedy
On 8/11/2010 12:21 PM, Pinku Surana wrote: I checked the svn repo at effbot.org, but it appears to have no updates since 2007. Has development moved elsewhere? It is now in the stdlib (19.11) as xml.etree.ElementTree http://svn.python.org/view/python/branches/py3k/Modules/_elementtree.c?revisio

Is ElementTree development still active?

2010-08-11 Thread Pinku Surana
I checked the svn repo at effbot.org, but it appears to have no updates since 2007. Has development moved elsewhere? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with Elementtree and XMLSchem instance type

2010-08-07 Thread Stefan Behnel
Roland Hedberg, 30.07.2010 15:21: I have the following XML snippet: http://www.w3.org/2001/XMLSchema-instance"; xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"; xsi:type="fed:SecurityTokenServiceType"> This part after parsing

Re: Problem with Elementtree and XMLSchem instance type

2010-08-02 Thread Lawrence D'Oliveiro
nks wrote: >> >>> My general feeling is that ElementTree is a lot handier for reading >>> and writing your own XML formats, than for handling XML files produced >>> by other tools. >> >> Why is that? I’ve successfully used it to parse SVG files produced by >

Re: Problem with Elementtree and XMLSchem instance type

2010-08-02 Thread NewBlue
> "Lawrence" == Lawrence D'Oliveiro > writes: Lawrence> In message Lawrence> , Lawrence> Roland Lawrence> Hedberg wrote: > And there is the problem, I've lost the coupling between the prefix >> 'fed' and the namespace >> "http://docs.oasis-open.org/wsfed/federati

Re: Problem with Elementtree and XMLSchem instance type

2010-08-01 Thread Carl Banks
On Aug 1, 5:43 pm, Lawrence D'Oliveiro wrote: > In message > <96e47fd8-c939-48a2-9a2b-92afa720c...@k1g2000prl.googlegroups.com>, Carl > > Banks wrote: > > My general feeling is that ElementTree is a lot handier for reading > > and writing your own XML formats, t

Re: Problem with Elementtree and XMLSchem instance type

2010-08-01 Thread Lawrence D'Oliveiro
In message <96e47fd8-c939-48a2-9a2b-92afa720c...@k1g2000prl.googlegroups.com>, Carl Banks wrote: > My general feeling is that ElementTree is a lot handier for reading > and writing your own XML formats, than for handling XML files produced > by other tools. Why is that? I’ve su

Re: Problem with Elementtree and XMLSchem instance type

2010-07-31 Thread Carl Banks
TokenServiceType"> >     > > > This part after parsing with Elementtree gives me an Element instance > with the following properties: > > > tree.tag > > {urn:oasis:names:tc:SAML:2.0:metadata}RoleDescriptor> tree.keys() > > ['{http://w

Re: Problem with Elementtree and XMLSchem instance type

2010-07-31 Thread Lawrence D'Oliveiro
In message , Roland Hedberg wrote: > And there is the problem, I've lost the coupling between the prefix > 'fed' and the namespace > "http://docs.oasis-open.org/wsfed/federation/200706";. Why is this a problem? -- http://mail.python.org/mailman/listinfo/python-list

Problem with Elementtree and XMLSchem instance type

2010-07-30 Thread Roland Hedberg
Hi! I have the following XML snippet: http://www.w3.org/2001/XMLSchema-instance"; xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"; xsi:type="fed:SecurityTokenServiceType"> This part after parsing with Elementtree gives me an Element

Re: Pretty printing with ElementTree

2010-07-09 Thread abhijeet thatte
It worked. Thanks, Abhijeet On Fri, Jul 9, 2010 at 4:03 PM, John Krukoff wrote: > On Fri, 2010-07-09 at 15:46 -0700, abhijeet thatte wrote: > > Hi, > > > > > > Does any one know how to use pretty printing with ElementTree while > > generating xml files. >

Re: Pretty printing with ElementTree

2010-07-09 Thread John Krukoff
On Fri, 2010-07-09 at 15:46 -0700, abhijeet thatte wrote: > Hi, > > > Does any one know how to use pretty printing with ElementTree while > generating xml files. > We can use that with lxml. But I want to stick with it ElementTree. > > > Thanks, > Abhijeet

Pretty printing with ElementTree

2010-07-09 Thread abhijeet thatte
Hi, Does any one know how to use pretty printing with ElementTree while generating xml files. We can use that with lxml. But I want to stick with it ElementTree. Thanks, Abhijeet -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree write creates large one line XML file ....

2010-05-28 Thread robert somerville
Thanks Robert Kern : "prettyprint" ; indent() does the trick ;-) >ElementTree writes exactly what you tell it to. In XML, whitespace is >significant. If you want newlines and/or indentation to make it pretty-looking, >then you need to add those to your elements. > >Fr

Re: ElementTree write creates large one line XML file ....

2010-05-27 Thread Sebastian Bassi
On Thu, May 27, 2010 at 9:13 PM, Robert Kern wrote: > ElementTree writes exactly what you tell it to. In XML, whitespace is > significant. If you want newlines and/or indentation to make it > pretty-looking, then you need to add those to your elements. This is not always true. Let me

Re: ElementTree write creates large one line XML file ....

2010-05-27 Thread Robert Kern
On 5/27/10 7:52 PM, robert somerville wrote: Hi I am using Ubuntu 9.10 and Python 2.6.4 .. when I create an ElementTree object and the write it out using: xml.etree.ElementTree.write() , I get one single long single line files, instead of something that looks reasonable , what gives ??? (and

ElementTree write creates large one line XML file ....

2010-05-27 Thread robert somerville
Hi I am using Ubuntu 9.10 and Python 2.6.4 .. when I create an ElementTree object and the write it out using: xml.etree.ElementTree.write() , I get one single long single line files, instead of something that looks reasonable , what gives ??? (and is it important ??) eg: I get : OneTwo

Re: Elementtree install problem in Ubuntu (a newbie ..)

2010-03-10 Thread Philip Semanchuk
On Mar 10, 2010, at 6:48 PM, robert somerville wrote: Hi ; I installed the elementtree and celementree packages throught the synaptic package manager, all seems to go fine through the install ... when i startup python and try to import them (as per the EFFBOTT.org suggestions) .. PROBLEMS

Elementtree install problem in Ubuntu (a newbie ..)

2010-03-10 Thread robert somerville
Hi ; I installed the elementtree and celementree packages throught the synaptic package manager, all seems to go fine through the install ... when i startup python and try to import them (as per the EFFBOTT.org suggestions) .. PROBLEMS ... (see below ..) What am i doing wrong ??? this is a new

  1   2   3   4   5   6   >