[XML-SIG] python, xml, html tags

Necati DEMiR ndemir at demir.web.tr
Mon Mar 28 20:01:36 CEST 2005


Hi,
I can't do something with Python and XML.

i have the following file;

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <test>
  <content> Hello </content>
  <content> <b> Hello </b> </content>
 </test>

Ok. it is simple :)

And i have the following python codes;

#!/usr/bin/python
from xml.dom import minidom

file = open("test.xml","r")
xml = minidom.parse(file)
print xml.childNodes[0].getElementsByTagName("content")[0].firstChild.data
print xml.childNodes[0].getElementsByTagName("content")[1].firstChild.data

Again simple one :)

But when i run these codes, i have the following output;
Hello

How can i access the second one. Yes, i know it contains html tags so it 
doesn't give me the result. I wanna get whole of the content as data. 
How can i do this?


-- 
---------------------------------------------------
Necati DEMiR
http://demir.web.tr

ndemir at demir.web.tr
0xAF7F745F
8525 9E78 F4EB 1DC6 51F3  1913 BB0D 7D9A AF7F 745F
---------------------------------------------------




More information about the XML-SIG mailing list