Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#729 closed defect (fixed)

Trouble with dojo.io.bind and XML

Reported by: anonymous Owned by: James Burke
Priority: high Milestone:
Component: Core Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

dojo.io.bind({

url: urlXML, useCache: true, preventCache: true, mimetype: "text/xml", handler: function(type, data, e) {

if(type == "load") {

var articles = data.getElementsByTagName("indexElt");

}

}

});

and a piece of my XML : <?xml version="1.0" encoding="UTF-8"?> <indexRoot> <indexElt mot="Hérité"> <lien url="Ont1.html" /> <lien url="Ont2.html" /> <lien url="Ont3.html" /> </indexElt> <indexElt mot="New"> <lien url="Agent0.html" /> <lien url="Agent1.html" /> <lien url="Domain1.html" /> </indexElt> </indexRoot> With FireFox?, this code tells me there are 2 articles in XML IE says zéro. in BrowserIO, if I change

if((kwArgs.mimetype == "application/xml")
(kwArgs.mimetype == "text/xml")){

ret = http.responseXML;

if(!ret
typeof ret == "string") {

ret = dojo.dom.createDocumentFromText(http.responseText);

}

} to

if((kwArgs.mimetype == "application/xml")
(kwArgs.mimetype == "text/xml")){

ret = dojo.dom.createDocumentFromText(http.responseText);

} I got the correct answer.

Change History (3)

comment:1 Changed 13 years ago by James Burke

Milestone: 0.3.1
Owner: changed from anonymous to James Burke
Status: newassigned

comment:2 Changed 13 years ago by James Burke

Resolution: fixed
Status: assignedclosed

Fix in r4197. I was able to reproduce this error in MSIE when loading tests/io/test_BrowserIO.frag.html from the local disk. It seems like MSIE does not treat the file as real XML file. I put in a fix to allow correct parsing for files served from local disk (response header of Content-Type is blank). This seems to work. If you are seeing this error from a page served from a web server, be sure that the file is being served with the right content type in the HTTP response headers (should be text/xml or application/xml).

comment:3 Changed 12 years ago by (none)

Milestone: 0.3.1

Milestone 0.3.1 deleted

Note: See TracTickets for help on using tickets.