Forum Moderators: open
I got one object [object HTL collection], when i try to fetch the xmo node data from javascript.
Below is code for object which i have created,
//Firefox
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
xmlhttp.overrideMimeType("application/xml");
xmlhttp.open("get",url,true);
xmlhttp.onreadystatechange=handleHttpResponse;
xmlhttp.send(null);
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp)
{
xmlhttp.open("GET",url,true)
xmlhttp.onreadystatechange=handleHttpResponse;
xmlhttp.send();
}
}
I got successfully xml data by "xmlhttp.responseText"
But when i try to fetch data by
xmlhttp.responseXML.getElementsByTagName("id"), it returns [Object HTML collection] and when i use xmlhttp.responseXML.getElementsByTagName("id").length, it returns "null".
Anyone here can help me?
Thnx in advance
regrds,
Zangs
<?xml version="1.0" encoding="iso-8859-1"?>
<list>
<iarticleid>12</iarticleid>
<itimecreated>17 days ago</itimecreated>
<varticleurl>http://www.rawstory.com/news/2006/Penny_costs_more_than_cent_to_0421.html</varticleurl>
<varticletitle>A penny actually costs 1.4 cents to produce</varticletitle>
<itotalrating>3</itotalrating>
<tdescription>The U.S. government is currently wrestling with the problem</tdescription>
<itotalcomments>0</itotalcomments>
<artrated>No</artrated>
<iuserid>1</iuserid>
<vusername>zangs</vusername>
<vfirstname>Michel</vfirstname>
<vlastname>Clerk</vlastname>
<viconimage>.</viconimage>
<icommenttorttype>.1</icommenttorttype>
<etargetwindow>.New</etargetwindow>
<eprofanityfilter>.</eprofanityfilter>
<icategoryid>1</icategoryid>
<vcategoryname>Headlines</vcategoryname>
</list>
this is my xml..
give me suggestion
regards,
Zangs
The closest thing I saw was: iuserid
so you would use: xmlhttp.responseXML.getElementsByTagName("iuserid") to get all iuserid tags...
Am I missing something else?
- JS