JS XML
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

JS XML

From: Adrian <Adrian@nospamhotmail.com.uk>
Date: Mon Jan 23 2006 - 22:49:01 CET

I have the following and I'm getting a bit lost!

I load an XML doc (see bottom of note) I want to find say Jane and read the
URL. How do I do it?!

thanks

oXmlDom = new ActiveXObject("Microsoft.XMLDOM");

oXmlDom.async = false;

if (oXmlDom.loadXML(xmltxt)) {

var oVNameNodes = oXmlDom.getElementsByTagName("test");

var iVNameCount = 0;

alert(oVNameNodes.length + " outer");

for (var iCount = 0; iCount < oVNameNodes.length; iCount++) {

alert(iCount + " inner");

var oNode = oVNameNodes(iCount);

alert("inner 1 " + oNode.ChildNodes.Item(iCount).Name());

alert( " inner 2");

}

xmldoc as follows

<?xml version="1.0" encoding="utf-8" ?>
<test>
<user>
 <Name>John</Name>
 <URL>http://www.John.co.uk</URL>

</user>
<user>
 <Name>Jane</Name>
 <URL>http://www.Jane.com</URL>

</user>
</test>
Received on Tue Feb 7 21:19:48 2006