Learning to program and I'm hitting some road blocks. Having trouble looking up an answer due to not knowing what the thing I'm looking for is called.
I'm using mini.dom to read an xml config file and I want to search for a tag name and write the "position id" to a variable. not sure what the position id is really called...
getElementsByTagName('tag')[0] <--- that 0 which means it was found first would be a 1 if found 2nd
What is the proper name of this and how could I do something like this
Code:
for element in node.getElementsByTagName('sometag'):
if element.firstChild.data == 'tagimlookingfor':
elementid = element.positioninthearray #<----how do I write the [0], or [1] to a variable so I can use it to discribe the position in the next line
var = node.getElementsByTagName('sometag')[elementid].firstChild.data
and yes I know I could just var = node.getElementsByTagName('tagimlookingfor')[0].firstChild.data but is a little more complicated then that I need to figure out the position do to the structure of the xml I'm parsing