If I load an XML document with the AJAX
get("
http://localhost...",myCallback,"xml") function from my server I am
able to use this XML object inside a jQuery function like $("user adress",
xmlDoc).each(...) to process the nodes.
If I try to load the same XML content from the file system via
get("file:///I:/SRC/html/test.xml",myCallback,"xml") the result is an simple
String containing the complete XML, but the query $("user adress",
xmlDoc).each(...) fails, because of the string nature of the returned
xmlDoc.
When I look into the code I see, that in the httpData() function
httpData: function(r,type) {
var ct = r.getResponseHeader("content-type");
var xml = ( !type || type == "xml" ) && ct &&
ct.indexOf("xml") >= 0;
return xml ? r.responseXML : r.responseText;
}
the old "force" idea is ignored, even if I specify "xml" as type -- I will
never get a content type for a local accessd file right? I guess var xml
should be true if the type is "xml" regardless of the responsheader (if
any).
I found an older version
jQuery.httpData = function(r,type) {
// Check the headers, or watch for a force override
return r.getResponseHeader("content-type").indexOf("xml") >
0 ||
type == "xml" ? r.responseXML : r.responseText;
};
wich really forced an xml document.
Is this a (known) bug or is there a workaround available? Or is there a
possibility to convert a valid XML string into a DOM?
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/