Consider the following xml file (lieferungen2.xml):
<?xml version="1.0"?>
<lieferungen>
<artikel id="1">
<name>apple</name>
<preis >2</preis>
<lieferant>Friedman</lieferant>
</artikel>
</lieferungen>
With the following code, I wanted to print "apple" to the command line:
import xml.dom.minidom
dom = xml.dom.minidom.parse("lieferungen2.xml")
a = dom.getElementsByTagName("artikel")
num=0
while(True):
if a[0].childNodes[num].nodeName != "name":
num++
else:
break
print(a[0].childNodes[num].childNodes[0].nodeValue)
However, I get the following error message:
num++
^
SyntaxError: invalid syntax
To me this syntax looks perfectly fine? What's wrong here?