tag replacement in toxml()

Manuel Ospina manuelospina at yahoo.es
Sun Apr 1 04:26:48 EDT 2007


Hi all,

I am new on the list and I already have a question :-(.

I have something like this:

import xml.dom.minidom
from xml.dom.minidom import getDOMImplementation
impl = getDOMImplementation()
myDoc = impl.createDocument(None, "example", None)
myRoot = myDoc.documentElement
myNode1 = myDoc.createElement("node")
myNode2 = myDoc.createElement("nodeTwo")
 myText = myDoc.createTextNode("Here is the <b>problem</>")
myNode2.appendChild(myText)
myNode1.appendChild(myNode2)
myRoot.appendChild(myNode1)
print myDoc.toxml()

The result is:
'<?xml version="1.0" ?>\n<example><node><nodeTwo>Here is the <b>problem</></nodeTwo></node></example>'


My question is how I can avoid that toxml() replaces the tags?

Regards,
Manuel




		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com



More information about the Python-list mailing list