[Twisted-Python] Help parsing with microdom

Abe Fettig abe at fettig.net
Tue Apr 19 17:14:09 EDT 2005

xhantt wrote:
> Hi, I'm using microdom to parse some xml input.
>>From the following example I wan to get 'hello' string
> import sys
> from twisted.web import microdom
> d = microdom.parseString('<html><body>hello</body></html>')
> print d.childNodes[0].childNodes[0].childNodes[0]
> But i get Text('hello'), please help any suggestion will be appreciated.

To get the string value of the Text node object, use:

print d.childNodes[0].childNodes[0].childNodes[0].nodeValue


More information about the Twisted-Python mailing list