getting text out of an xml string

JT jeff.templon at gmail.com
Fri Mar 4 14:53:45 EST 2011


Yo,

 So I have almost convinced a small program to do what I want it to
do.  One thing remains (at least, one thing I know of at the moment):
I am converting xml to some other format, and there are strings in the
xml like this.

The python:

elif v == "content":
                print "content", a.childNodes[0].nodeValue

what gets printed:

content \u3c00note xml:space="preserve"\u3e00see forms in red inbox
\u3c00/note\u3e00

what this should say is "see forms in red inbox" because that is what
the the program whose xml file i am trying to convert, properly
displays, because that is what I typed in oh so long ago.  So my
question to you is, how can I convert this "enhanced" version to a
normal string?  Esp. since there is this "xml:space="preserve"" thing
in there ... I suspect the rest is just some unicode issue.  Thanks
for any help.

       J "long time no post" T



More information about the Python-list mailing list