Opened 16 years ago
Closed 16 years ago
#174 closed enhancement (duplicate)
Handling XML documents with namespaces
Reported by: | john | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core | Version: | |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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 "-W3CDTD XHTML 1.0 TransitionalEN" "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>
Change History (6)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Priority: | major → minor |
---|---|
Type: | bug → feature |
IE bugs have been solved, but handling namespaces as a different topic.
comment:3 Changed 16 years ago by
Version: | → 1.0 |
---|
Handling namespaces may be introduced in 1.1 by using the pipe symbol ("|").
comment:4 Changed 16 years ago by
Summary: | responseXML issues in IE → Handling XML documents with namespaces (was: responseXML issues in IE) |
---|
comment:5 Changed 16 years ago by
Component: | ajax → core |
---|---|
Summary: | Handling XML documents with namespaces (was: responseXML issues in IE) → Handling XML documents with namespaces |
Type: | feature → enhancement |
Version: | 1.0 |
comment:6 Changed 16 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Merging this ticket with #155.
Added test to SVN. jQuery is currently unable to handle namespaces, but we should be able to fix the problems for IE.