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):
> >
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
> >>>
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
>>> b) beforeCtag.text when printed display
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
> > b) beforeCtag.text when printed displays: I'm confused
> > c) afte
[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
> b) beforeCtag.text when printed displays: I'm confused
> c) afterCtag.text is of type
> d) afterCt
[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
[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/argume
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 =