Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-17-2007, 09:02 PM
Member
 
Join Date: Dec 2007
Posts: 1
Fiona80 is on a distinguished road
Problem reading an xml file with AJAX
I am trying to read the xml file that is retrieved with AJAX, I want to read the coordinates of the file. Below I show the function that creates the ajaxrequest object and the ajax call to the server. IE sends me the message error "object null" in the line where the "for" starts.

I dont know what the problem is. Any idea?

Thank you for your help.



function ajaxcoord(){
var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
//alert("Your browser broke!");
return false;
}
}
}

// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var xml = ajaxRequest.responseXML.documentElement;
for (i = 0; i < xml.getElementsByTagName('SRS name').length; i++){
var item = xml.getElementsByTagName('CTS_Response')[i];
var txt = item.getElementsByTagName('COORDS values')[0].firstChild.data;
alert(txt);
}
}
}
ajaxRequest.open("GET","https://upd.geodatenzentrum.de/cts/server?REQUEST=GetCoordinates&FROMSRS=GEO84&TOSRS= GK3&COORDS=10 50 11 51",true);
ajaxRequest.send('');
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a File into ByteArray Java Tip Java Tips 0 01-15-2008 04:19 PM
Reading a file mew New To Java 2 12-30-2007 01:23 PM
Reading file header mew New To Java 0 12-19-2007 10:39 AM
Reading a file for use peachyco New To Java 2 11-27-2007 04:49 AM
Reading from a file leebee New To Java 1 07-23-2007 01:02 PM


All times are GMT +3. The time now is 09:19 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org