Hello!
I've an XML like this:
[CODE=xml]<XML id=SlideShowDat a>
<SlideShowDat a>
<SLIDES>
<SLIDE FileName="filen ame1.jpg" Caption="descri zione1"/>
<SLIDE FileName="filen ame2.jpg" Caption="descri zione2"/>
</SLIDES>
</SlideShowData>
</XML>
[/CODE]
My javascript should create an Array from this XML. It works with Explorer while returns "parent has no properties" error with Firefox.
This is the two functions:
[CODE=javascript]function InitSlideData()
{var SlidesNode =
FindChildNode(S lideShowData.do cumentElement, "SLIDES");
if (SlidesNode == null)
return;
var ChildNodes = SlidesNode.getE lementsByTagNam e("SLIDE");
for (i = 0; i < ChildNodes.leng th; i++)
{SlideImages[i] = ChildNodes.item (i).attributes. getNamedItem("F ileName").value ;
SlideCaptions[i] = ChildNodes.item (i).attributes. getNamedItem("C aption").value;
}
}
function FindChildNode(p arent, name)
{ var ChildNodes = parent.getEleme ntsByTagName(na me); //here occurs the error!!
for (i = 0; i < ChildNodes.leng th; i++)
if (ChildNodes.ite m(i).nodeName == name)
return ChildNodes.item (i);
return null;
}[/CODE]
Please help me, thankyou in advance!
Em
I've an XML like this:
[CODE=xml]<XML id=SlideShowDat a>
<SlideShowDat a>
<SLIDES>
<SLIDE FileName="filen ame1.jpg" Caption="descri zione1"/>
<SLIDE FileName="filen ame2.jpg" Caption="descri zione2"/>
</SLIDES>
</SlideShowData>
</XML>
[/CODE]
My javascript should create an Array from this XML. It works with Explorer while returns "parent has no properties" error with Firefox.
This is the two functions:
[CODE=javascript]function InitSlideData()
{var SlidesNode =
FindChildNode(S lideShowData.do cumentElement, "SLIDES");
if (SlidesNode == null)
return;
var ChildNodes = SlidesNode.getE lementsByTagNam e("SLIDE");
for (i = 0; i < ChildNodes.leng th; i++)
{SlideImages[i] = ChildNodes.item (i).attributes. getNamedItem("F ileName").value ;
SlideCaptions[i] = ChildNodes.item (i).attributes. getNamedItem("C aption").value;
}
}
function FindChildNode(p arent, name)
{ var ChildNodes = parent.getEleme ntsByTagName(na me); //here occurs the error!!
for (i = 0; i < ChildNodes.leng th; i++)
if (ChildNodes.ite m(i).nodeName == name)
return ChildNodes.item (i);
return null;
}[/CODE]
Please help me, thankyou in advance!
Em
Comment