I am new to Python, and need help doing the following:
I have data stored in an XML file like this: I can find the value of a particular attribute in a particular tag, by the following
<vehicle make="toyota" model="yaris">
New model - 1 litre Terra
Electric windows, passenger airbag, ABS, immobiliser
Sunroof, air-conditioning, metallic paint
I can find the value of a particular attribute in a particular tag (in this case the make of a vehicle), by the following:
from xml.dom import minidom
xmldoc = minidom.parse('C:\Documents and Settings\All Users\Documents\Programming\GarageInfo.xml')
vehicletag = xmldoc.getElementsByTagName('vehicle')
vehicletaglist = vehicletag
vehiclename = vehicletaglist.attributes["make"]
What I need to be able to do is find the values of 'make' from ALL the 'vehicle' tags, and then to store these values in variables or somewhere, so that I can access then later in the programme.
Some kind of loop probably?
Hope someone can help,