Ghost data from XML file
Hi Scripters,
I got ghost data from my XML file by the import.
In the XML file are 3 times the parent content 'HALSRIEMEN-GEFL' but I get it 5 times, I have no idea anymore and hope anybody see the problem.
My scheme:
<products-profdog>
<product>
<item-id></item-id>
<type></type>
<title></title>
<additive></additive>
<description></description>
<category></category>
<volume-unit></volume-unit>
<weight></weight>
<matchcode></matchcode>
<ean-number></ean-number>
<price-unit></price-unit>
<stock></stock>
<parent></parent>
<active-shop></active-shop>
<active-catalog></active-catalog>
<sort></sort>
</product>
<product>
<item-id></item-id>
<type></type>
<title></title>
<additive></additive>
<description></description>
<category></category>
<volume-unit></volume-unit>
<weight></weight>
<matchcode></matchcode>
<ean-number></ean-number>
<price-unit></price-unit>
<stock></stock>
<parent></parent>
<active-shop></active-shop>
<active-catalog></active-catalog>
<sort></sort>
</product>
</products-profdog>
My loop:
for (i = 0; i < myRootXMLElement.xmlElements.length; i++) {
for (ii = 0; ii < myRootXMLElement.xmlElements.item(i).xmlElements.length; ii++) {
if(myRootXMLElement.xmlElements.item(i).xmlElements.item(ii).markupTag.name == 'parent'){
if(myRootXMLElement.xmlElements.item(i).xmlElements.item(ii).contents == 'HALSRIEMEN-GEFL'){
alert( myRootXMLElement.xmlElements.item(i).xmlElements.item(ii).markupTag.name + ' -> ' + myRootXMLElement.xmlElements.item(i).xmlElements.item(ii).contents );
}
}
}
}
