mam dokument <br><br><?xml version="1.0" encoding="utf-8"?><br> <info><br> <name>test</name><br> <description/><br> <directory>/</directory><br> </info><br>
<br>a rad bych modifikoval hodnotu description takze vysledek by pak vypadal takto:<br><br><?xml version="1.0" encoding="utf-8"?><br>
<info><br>
<name>test</name><br>
<description>popisek</description><br>
<directory>/</directory><br>
</info><br>
<br><br>tady jsem nejak zamrznul. Pokud je description ve tvaru <description/> tak do nej nemuzu mimo atributu zaboha nic vlozit..<br><br>import xml.dom.minidom<br>from xml.dom.minidom import Node<br><br>doc = xml.dom.minidom.parse('c:\\devel\\test\\pokus.xml')<br>
for step in doc.getElementsByTagName("info"):<br> x = step.getElementsByTagName("description")[0]<br> try:<br> x.nodeValue('popisek')<br> except:<br> print "a co ted ?"<br>
<br>print doc.toxml('utf-8')<br><br><br>Ondřej Beránek<br>