Hi John,

yes I first encountered the problem with an earlier version.
I now replaced the old version of jQuery with the version you specified and
replaced the deprecated syntax.

The problem still persists.
In a responseXML containing XML without namespaces, Opera and FF find all the
elements and IE finds nothing.
If the responseXML contains namespaces but doesn't use prefixes, FF and Opera
find all the elements (ignoring the namespaces of the elements) and IE finds
nothing.
If the responseXML contains both namespaces prefixes, no browser finds the
elements (but I guess for different reasons).


I don't know if the mailing list accepts attachments so I'll include the test
case I used here:

First the JS: <test.js>

function testFunc() {
    function jqueryback(httprequest) {
      var resp = httprequest.responseXML;

      $("body").append("<p>divs found in document: "+$("div").length+"/3</p>");
      $("body").append("<p>properties found in responseXML "+$("properties", 
resp).length+"/1</p>");
      $("body").append("<p>jsconf found in responseXML "+$("jsconf", 
resp).length+"/1</p>");
      $("body").append("<p>things found in responseXML "+$("thing", 
resp).length+"/2</p>");
    }
    $.ajax({
            url: "with_fries.xml",
            type: "GET",
            data: "",
            success: jqueryback
    });
}

The XML: <with_fries.xml> (to get the other two testcases simply remove the 
prefixes and/or namespace declarations

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soap:Body>
    <jsconf xmlns="http://www.example.com/ns1";>
      <ab:response xmlns:ab="http://www.example.com/ns2";>
        <ab:meta>
          <ab:component id="seite1">
            <cd:properties xmlns:cd="http://www.example.com/ns3";>
              <cd:property 
name="prop1"><cd:thing/><cd:value>1</cd:value></cd:property>
              <cd:property name="prop2"><cd:thing 
att="something"/></cd:property>
            </cd:properties>
          </ab:component>
        </ab:meta>
      </ab:response>
    </jsconf>
  </soap:Body>
</soap:Envelope>

And the html file: <test.html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html>
<head>
  <title>XML Test</title>
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <meta http-equiv="expires" content="0">
  <script src="jquery-1.0.js" type="text/javascript"></script>
  <script src="test.js" type="text/javascript"></script>
  <script type="text/javascript">$(document).ready(testFunc);</script>
</head>
<body>
<div>
        <div><div>Testing jQuery's ability to find nodes in responseXML on 
various browsers</div></div>
</div>
</body>
</html>


Thank you!

John Resig wrote:
> 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

 Web : http://www.efkon.com
********************************************************

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to