Re: the tostring and XML methods in ElementTree

2006-05-19 Thread Stefan Behnel
George Sakkis wrote: Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: I wanted to see what would happen if one used the results of a tostring method as input into the XML method. What I observed is this: a) beforeCtag.text is of type type 'str' b) beforeCtag.text when printed displays: I'm

Re: the tostring and XML methods in ElementTree

2006-05-19 Thread George Sakkis
Stefan Behnel wrote: George Sakkis wrote: Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: I wanted to see what would happen if one used the results of a tostring method as input into the XML method. What I observed is this: a) beforeCtag.text is of type type 'str' b)

Re: the tostring and XML methods in ElementTree

2006-05-19 Thread Serge Orlov
George Sakkis wrote: I'm currently using (a variation of) the workaround below instead of ET.tostring and it works fine for me: def tostring(element, encoding=None): text = element.text if text: if not isinstance(text, basestring): text2 =

Re: the tostring and XML methods in ElementTree

2006-05-17 Thread George Sakkis
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: I wanted to see what would happen if one used the results of a tostring method as input into the XML method. What I observed is this: a) beforeCtag.text is of type type 'str' b) beforeCtag.text when printed displays: I'm confused c)

Re: the tostring and XML methods in ElementTree

2006-05-08 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I wanted to see what would happen if one used the results of a tostring method as input into the XML method. What I observed is this: a) beforeCtag.text is of type type 'str' b) beforeCtag.text when printed displays: I'm confused c) afterCtag.text is of type type

the tostring and XML methods in ElementTree

2006-05-07 Thread mirandacascade
O/S: Windows XP Home Vsn of Python: 2.4 Copy/paste of interactive window is immediately below; the text/questions toward the bottom of this post will refer to the content of the copy/paste from elementtree import ElementTree beforeRoot = ElementTree.Element('beforeRoot') beforeCtag =

Re: the tostring and XML methods in ElementTree

2006-05-07 Thread Serge Orlov
[EMAIL PROTECTED] wrote: Question 1: assuming the following: a) beforeCtag.text gets assigned a value of 'I\x92m confused' b) afterRoot is built using the XML() method where the input to the XML() method is the results of a tostring() method from beforeRoot Are there any settings/arguments

Re: the tostring and XML methods in ElementTree

2006-05-07 Thread Serge Orlov
[EMAIL PROTECTED] wrote: O/S: Windows XP Home Vsn of Python: 2.4 [snip fighting with unicode character U+2019 (RIGHT SINGLE QUOTATION MARK) ] I don't know what console you use but if it is IDLE you'll get confused even more because it is buggy and improperly handles that character: print