Hi Mario -
It appears as if you're using an old version of jQuery, could you try
it with jQuery 1.0?
http://jquery.com/src/jquery-1.0.js
The syntax that you used was deprecated, doing:
$("properties", resp).cur.length
You can now do:
$("properteis, resp).size()
or:
$("properties", resp).length
To get what you need - if you could try it with the new version and
see if the problem still occurs, I'd really appreciate it.
--John
On 8/30/06, Mario Landgraf <[EMAIL PROTECTED]> wrote:
> 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/
>
--
John Resig
http://ejohn.org/
[EMAIL PROTECTED]
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/