get textual content of a Xml element using 4DOM

and-google at doxdesk.com and-google at doxdesk.com
Sun Mar 6 03:21:16 EST 2005


Frank Abel Cancio Bello <FRANKA... at esla.cujae.edu.cu> wrote:

> PrettyPrint or Print return the value to the console, and i need
> keep this  value in a string variable to work with it, how can i
> do this?

The second parameter to either of these functions can be a stream
object, so you can use a StringIO to get string output:

  from StringIO import StringIO
  from xml.dom.ext import Print

  buf= StringIO()
  Print(doc, buf)
  xml= buf.getvalue()

-- 
Andrew Clover
http://www.doxdesk.com/
mailto:and at doxdesk.com




More information about the Python-list mailing list