I have this XML file:
<?xml version="1.0" ?><XMLSchemaPalletLoadTechData xmlns="http://tempuri.org/XMLSchemaPalletLoadTechData.xsd">
<TechDataParams>
<RunNumber>sample</RunNumber>
<Holder>sample</Holder>
<ProcessToolName>sample</ProcessToolName>
<RecipeName>sample</RecipeName>
<PalletName>sample</PalletName>
<PalletPosition>sample</PalletPosition>
<IsControl>sample</IsControl>
<LoadPosition>sample</LoadPosition>
<HolderJob>sample</HolderJob>
<IsSPC>sample</IsSPC>
<MeasurementType>sample</MeasurementType>
</TechDataParams>
<TechDataParams>
<RunNumber>sample</RunNumber>
<Holder>sample</Holder>
<ProcessToolName>sample</ProcessToolName>
<RecipeName>sample</RecipeName>
<PalletName>sample</PalletName>
<PalletPosition>sample</PalletPosition>
<IsControl>sample</IsControl>
<LoadPosition>sample</LoadPosition>
<HolderJob>sample</HolderJob>
<IsSPC>sample</IsSPC>
<MeasurementType>XRF</MeasurementType>
</TechDataParams>
</XMLSchemaPalletLoadTechData>
And this is my code for parsing the xml:
for data in xml.getElementsByTagName('TechDataParams'):
#parse xml
runnum=data.getElementsByTagName('RunNumber')[0].firstChild.nodeValue
hold=data.getElementsByTagName('Holder')[0].firstChild.nodeValue
processtn=data.getElementsByTagName('ProcessToolName'[0].firstChild.nodeValue)
recipedata=data.getElementsByTagName('RecipeName'[0].firstChild.nodeValue)
palletna=data.getElementsByTagName('PalletName')[0].firstChild.nodeValue
palletposi=data.getElementsByTagName('PalletPosition')[0].firstChild.nodeValue
control = data.getElementsByTagName('IsControl')[0].firstChild.nodeValue
loadpos=data.getElementsByTagName('LoadPosition')[0].firstChild.nodeValue
holderjob=data.getElementsByTagName('HolderJob')[0].firstChild.nodeValue
spc = data.getElementsByTagName('IsSPC')[0].firstChild.nodeValue
mestype = data.getElementsByTagName('MeasurementType')[0].firstChild.nodeValue
but when i print each node, i am only getting one set of 'TechDataParams', but I want to be able to get all 'TechDataParams' from the XML.
Let me know if my question is a bit unclear.