AJAX Forums

Processing an XML document in Javascript

This is a discussion on Processing an XML document in Javascript within the AJAX Questions forums, part of the Beginners AJAX category; Hi, I have a Javascript function that creates a Ajax request to retrieve data from a database using a PHP script. The data returned by the PHP script is an ...


Go Back   AJAX Forums > Beginners AJAX > AJAX Questions

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Old 07-21-2007, 07:44 PM   #1 (permalink)
Junior Member
 
Join Date: Jul 2007
Posts: 1
Rep Power: 0 Sebarry is on a distinguished road
Processing an XML document in Javascript

Hi,

I have a Javascript function that creates a Ajax request to retrieve data from a database using a PHP script. The data returned by the PHP script is an XML Document that I access through transport.responseXML. The structure of the XML document is as follows:

<job>
<contactTelephone>028 ---------</contactTelephone>
<contactName>Karen -------</contactName>
<contactFax>028 -----------</contactFax>
<contactEmail>karen@---------</contactEmail>
<contactWebsite>www.---------</contactWebsite>
</job>

I use var xmlOptions = xmlDoc.getElementsByTagName('job'); to get job and then xmlOptions[0].getElementsByTagName('contactTelephone')[0].firstChild.data but can I use a for loop to process the XML document tag by tag without hardcoding it? Using a variable in getElementsByTagName?

Thanks,

Sean
Sebarry is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes



All times are GMT -4. The time now is 03:24 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
Copyright ©2006 - 2008, AJAXwith.com