• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ramesh Shanmugam
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deva subramani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at this article I wrote:

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

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic