Side navigation
#174 closed enhancement (duplicate)
Opened September 02, 2006 09:56AM UTC
Closed December 23, 2006 05:58PM UTC
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>
Attachments (0)
Change History (6)
Changed October 13, 2006 02:57PM UTC by comment:1
Changed November 08, 2006 03:20PM UTC by comment:2
priority: | major → minor |
---|---|
type: | bug → feature |
IE bugs have been solved, but handling namespaces as a different topic.
Changed November 11, 2006 01:09PM UTC by comment:3
version: | → 1.0 |
---|
Handling namespaces may be introduced in 1.1 by using the pipe symbol ("|").
Changed November 11, 2006 01:12PM UTC by comment:4
summary: | responseXML issues in IE → Handling XML documents with namespaces (was: responseXML issues in IE) |
---|
Added test to SVN. jQuery is currently unable to handle namespaces, but we should be able to fix the problems for IE.