•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 392,088 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,945 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1434 | Replies: 1
![]() |
•
•
Join Date: Jul 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I have a Javascript function that creates an Ajax request, returning an XML document into
Thanks,
Sean
I have a Javascript function that creates an Ajax request, returning an XML document into
transport.responseXML. I want to process this document but without hardcoding each tag name i.e. xmlOptions[0].getElementsByTagName('salary')[0].firstChild.data . I would like to iterate over the XML document and find each tag and its value. The XML document I want to process is structured as such:<job> <contactTelephone>028 ---------</contactTelephone> <contactName>Karen -------</contactName> <contactFax>028 -----------</contactFax> <contactEmail>karen@---------</contactEmail> <contactWebsite>www.---------</contactWebsite> </job>
Thanks,
Sean
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
Just loop through the array like you would any other array. See that zero? It can be a variable, too.
for (var i = 0; i < xmlOptions[0].getElementsByTagName('salary').length; i++)
{
document.write(xmlOptions[0].getElementsByTagName('salary')[i]);
} John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Parse a XML element with AJAX (JavaScript / DHTML / AJAX)
- How to Parse XML in ASP? (ASP)
- Searching and Comparing strings from an XML Document (Python)
- Database table convert to xml document to cache (VB.NET)
- How to Parse XML file (RSS, Web Services and SOAP)
- Parse XML from ASP!!! (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: cant open email.
- Next Thread: javascript and css



Linear Mode