Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Using javascript to grab a node out of xml

Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
New one
New one

Joined: 21 Apr 2009
Posts: 1

PostPosted: Tue Apr 21, 2009 6:39 am    Post subject: Using javascript to grab a node out of xml Reply with quote


I am having difficulty figuring out how to get javascript to read some nodes from my xml file. Please note, I can get js to read some nodes. But some I am not able to.

Here is my xml file:
<?xml version="1.0" ?>
      <title>Sample Project 1</title>
      <description>Description goes here </description>

If I want to read from the title node, I just use the js like this:
var titleValue = http2.responseXML.getElementsByTagName("title");

Ditto for the projectImage and description nodes. However I do not know how to grab all the images under the subImage node.

The final result of this would be that I print a page that shows a Projects title, projectImage, description and then lists all the images as you find them in subImage.

It is ok to illustrate this with prototype.js.

Just wanted to clarify too that the http2 above is an object created from the xmlhttp request object. See the code below:

function getXMLHTTPRequest() {
    try {
        req = new XMLHttpRequest();
    } catch(err1) {
      try {
          req = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (err2) {
        try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (err3) {
             req = false;
    return req;

var http2 = getXMLHTTPRequest();

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 XML & Copyright Notice 

Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X

Link to our site:


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos

Normal Bookmark

Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax

Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?

it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert