wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes [B]Error while reading XML from Webserver using Ajax[/B] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "[B]Error while reading XML from Webserver using Ajax[/B]" Watch "[B]Error while reading XML from Webserver using Ajax[/B]" New topic
Author

[B]Error while reading XML from Webserver using Ajax[/B]

Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
Hi all,

i have an XML placed @ webserver..
i have to read that XML from the webserver using AJAX and have to update my HTML DOM

in the scenario
if i use
var items = req.responseXML.getElementsByTagName("item");
it is not returning any of the value..
but if i use
var itemTxt = req.responseText;

I could able to get the whole values that are available in the XML file.

pls help me how to get the values from the .xml file as a XML element.

Thanks in advance
Ramesh


Ramesh Shanmugam - SCJP 1.5
Deva subramani
Greenhorn

Joined: Nov 17, 2005
Posts: 2
Before you do this, Better go through this tutorials.you can find it useful
http://www.javarss.com/ajax/j2ee-ajax.html

Thanks
Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
Dear Deva subramani ,

Thanks for your Reply.. actually i have gone thru that link already..
i am using Weblogic as a Application server and iplanet webserver.

It works fine with the Tomcat 5.0

pls reply how to proceed and get the response as XML using AJAX.

Thanks in advance,
ramesh
Deva subramani
Greenhorn

Joined: Nov 17, 2005
Posts: 2
Whatever may be the server... it should work fine...we are using only javascript and xml in ajax.So it should work in weblogic too...

Try to do.All the best

Thanks
Sanjiv Jivan
Ranch Hand

Joined: Nov 03, 2005
Posts: 52
Make sure that the content type of the reponse is set to "text/xml". If its not text/xml, then req.reponseXML will return null and not the parsed DOM.

Hope this helps,
Sanjiv
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Take a look at this article I wrote:

http://radio.javaranch.com/pascarello/2005/10/26/1130348276996.html

Eric
 
 
subject: [B]Error while reading XML from Webserver using Ajax[/B]