Voici mon fichier xmlPython XML- devient ce qui est entre deux nœuds
<gui>
<object class="wxPanel" name="new">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="a"></object>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
</object>
</gui>
Je veux obtenir exactement ce qui est entre la balise IUG
Je ne voudrais donc ceci:
<object class="wxPanel" name="new">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="a"></object>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
</object>
J'utilise actuellement
minidom.parse("path to xml").getElementsByTagName('gui')[0].firstChild.nodeValue
Toutefois, cela ne fonctionne pas avec l'obtention de xml en tant que chaîne.
Avez-vous essayé '.innerXML' ou' .innerHTML'? – Blender