Helen- Thank you very much. This is exactly what I needed. I was close with my initial attempts, but had the syntax off.
Thanks - Tom Schreck 817-252-4900 [EMAIL PROTECTED] I have not failed. I've found 10,000 ways that won't work. - Thomas Edison -----Original Message----- From: Helen Warren [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 4:52 AM To: [EMAIL PROTECTED] Subject: Re: [cf-xml] returning xml to javascript Hi Tom, So, assuming Javascript has got hold of the xml packet - treated as a string - you could use the Microsoft XML parser as an activeX object (IE specific, but perhaps that's okay for you). Here's a quick example, I had an xml packet containing information about companies (company id and name). I am assuming that Javascript sees your xml packet as a string called XMLString /*instantiate activeX object*/ var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); /*load xml packet into this object*/ ok = xmlDoc.loadXML(XMLString); /*obtain relevant nodes in the packet (in my case, all the companies)*/ nodeList = xmlDoc.selectNodes('companies/company'); /*loop through the nodes*/ for (var i=0; i<nodeList.length; i++) { oNode = nodeList.item(i); children = oNode.childNodes; company_id = children.item(0).text; company_name = children.item(1).text; /*now I have a handle on the name and id of the company use this to populate the html on your page e.g. document.write(company_name+"<br />") and so on*/ } Perhaps you could use something along these lines? Hope that helps you. Helen. Helen Warren [EMAIL PROTECTED] http://www.torchbox.com ------ Forwarded Message > From: "Schreck, Tom" <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > Date: Thu, 16 May 2002 10:02:52 -0500 > To: <[EMAIL PROTECTED]> > Subject: [cf-xml] returning xml to javascript > > I have a situation where I call an action page that produces an XML document. > The action page is called through an IFRAME and it returns the xml packet to a > JavaScript function on the parent. I want to be able to loop through the XML > document and populate a drop down box without reloading the page. I�m > successful getting the action page to return the xml packet to the parent�s > JavaScript function, but I can not get JavaScript to work with the xml data. > I�ve tried the various methods available to the xml document but nothing > works. Any help would be appreciated. > > ------ End of Forwarded Message -----------------------+ cf-xml mailing list list: [EMAIL PROTECTED] admin: [EMAIL PROTECTED] home: http://torchbox.com/xml -----------------------+ cf-xml mailing list list: [EMAIL PROTECTED] admin: [EMAIL PROTECTED] home: http://torchbox.com/xml
