[Twisted-Python] Help parsing with microdom
![](https://secure.gravatar.com/avatar/d18a193f8b3699812c0f0a397a0520b8.jpg?s=120&d=mm&r=g)
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.
![](https://secure.gravatar.com/avatar/6cd37343ce1da139b1d2ff5ee717f5d5.jpg?s=120&d=mm&r=g)
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 Abe
participants (2)
-
Abe Fettig
-
xhantt