I want to read such xml

<DBMAIL>
<Function>FolderList</Function>
<Status>Sucess</Status>
<FolderList>
<folder>INBOX</folder>
<folder>SENT</folder>
<folder>OUTBOX</folder>
<folder>TRASH</folder>
</FolderList>
<Untagged>Recent Flag List</Untagged>
</DBMAIL>

here is the Javascripte that I used for it

function readFolders(){

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","xml/folderlist.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
}





here I doing this in browser console



xmlDoc



image



to get the value of in xml



xmlDoc.getElementsByTagName("Function")[0].childNodes[0].nodeValue;



image



How get nested one it easy too



xmlDoc.getElementsByTagName("folder")



this will return array



image



how to get that value only?



x[0].childNodes[0].nodeValue



image

0

Add a comment

I am
I am
Archives
Total Pageviews
Total Pageviews
2 0 5 7 7 0 6
Categories
Categories
Loading