I'm trying to iterate over all "value" tags of "variant", the code does not jump to the next "value" key since xml has another "value" keys under "FIRST VALUE KEY"
<variant>
<name>PROGRAMS</name>
<value> <!-- Lets call it FIRST VALUE KEY -->
<value>PROG1</value>
<statistics>
<statistic name="Stats">
<value>5</value>
</statistic>
</statistics>
</value>
<value> <!-- SECOND VALUE KEY -->
<value>PROG2</value>
...
</value>
</variant>
<variant>
<name>OTHER</name>
...
</variant>
Here is my python code
for keys in root.iter('variant'):
for variant in keys:
if variant.text == 'PROGRAMS':
for value_tag in keys.iter('value'):
ParamValue = value_tag.find('value').text
if ParamValue == 'PROG2':
print "GOT IT!"
else: continue # <- this jumps to the "<value>PROG1</value>" tag
# but it should jump to the "SECOND VALUE KEY"
Where's the issue?
if ParamValue == 'PROG2':condition