Hi!
I ran into the following problem trying to retrieve
elements from responseXML with this function:
function callback(httprequest) {
var resp = httprequest.responseXML;
$("body").append("<p>divs found in document: "+$("div").cur.length+"/3</p>")
.append("<p>properties found in responseXML "+$("properties",
resp).cur.length+"/1</p>")
.append("<p>jsconf found in responseXML "+$("jsconf",
resp).cur.length+"/1</p>")
.append("<p>things found in responseXML "+$("thing",
resp).cur.length+"/2</p>");
}
The first append allways works as expected, but the last
three (the ones that select elements from resp) behave
differently depending on the browser and the content of responseXML...
Case 1: elements in resp contain no namespaces
(e.g. <Envelope></Envelope>)
Works in Opera8+ and Firefox 1.5+
Does not find any elements in IE6
Case 2: elements in resp contain namespaces but have no prefixes
(e.g. <Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/"></Envelope>)
Works in Opera8+ and Firefox 1.5+. As I expected both browsers simply ignore
the namespace of
the elements and select all elements with the specified tagName.
Does not find any elements in IE6.
Case 3: elements in resp have namespaces and prefixes defined
(e.g. <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"></soap:Envelope>)
Firefox and Opera can't find elements with prefixes.
As far as I have seen, this is caused in jQuery.filter()
by this snipped of code:
"m[2]== '*'||a.nodeName.toUpperCase()==m[2].toUpperCase()"
which is defined in jQuery.g (specifically by comparing with
the nodeName, which is a combination of localName and prefix).
By replacing this with code that compares m[2] with either the
localName (if it exists) or the nodeName I managed to get FF and
Opera to behave just as in Case 2*.
IE does not find any elements.
Now my questions:
Is there a possible way to get behaviour that FF and Opera
show in case 2 (and modified case 3) from all three major
browsers?
If there isn't, is there another way I can extract elements
by their nodeName or localName from responseXML that works
the same in these browsers?
thanks in advance
Mario
*In case someone is interested, the code I used was:
"m[2]== '*'||((a.localName != null) ?
a.localName.toUpperCase()==m[2].toUpperCase() :
a.nodeName.toUpperCase()==m[2].toUpperCase())"
PS: If necessary I can supply a minimal testcase.
--
********************************************************
EFKON AG
Mario Landgraf
System Development
ITS Projects
Am Arlandgrund 2
8045 GRAZ
AUSTRIA
Mail: [EMAIL PROTECTED]
Web : http://www.efkon.com
********************************************************
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/