Hi,
I'm new to the javascript XML(DOM) API.
I'm trying to:
- Read some xml data (from the server, synchronously).
- Parse it (using javascript DOM API).
Unfortunately, javascript keept telling me that it found an empty xml document (no child nodes)...
Could anyone guess what's wrong ?
BTW I can tell the request *does* arrive to my server (I'm logging it).
Thanks a lot.
My server-side xml (generated through java/jsp).
Notes:
- I can tell this *is* being called:
- I've tried it with and without the '<? xml ... ?> directive.
My javascript (meant for Firefox 5):
I'm new to the javascript XML(DOM) API.
I'm trying to:
- Read some xml data (from the server, synchronously).
- Parse it (using javascript DOM API).
Unfortunately, javascript keept telling me that it found an empty xml document (no child nodes)...
Could anyone guess what's wrong ?
BTW I can tell the request *does* arrive to my server (I'm logging it).
Thanks a lot.
My server-side xml (generated through java/jsp).
Notes:
- I can tell this *is* being called:
- I've tried it with and without the '<? xml ... ?> directive.
Code:
<%@page contentType="text/xml" %>
<? xml version="1.0" ?>
<users><user name='john'></user></users>
<%
System.out.println("server sending xml response");
%>
My javascript (meant for Firefox 5):
Code:
// Firefox 5 code:
function testXml(){
var xmldoc = document.implementation.createDocument(null, null, null);
xmldoc.async = false;
xmldoc.load("[URL unfurl="true"]http://myDomain/MT/MANTIS/pelTest");[/URL]
var children= xmldoc.childNodes;
alert(children.length);