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
to get the value of in xml
xmlDoc.getElementsByTagName("Function")[0].childNodes[0].nodeValue;
How get nested one it easy too
xmlDoc.getElementsByTagName("folder")
this will return array
how to get that value only?
x[0].childNodes[0].nodeValue
Add a comment