[jQuery] Browser differences in handling xml file structures?

[jQuery] Browser differences in handling xml file structures?


Hi all,
This is my first posting to this group, so I hope you will treat me
gently.
I am having a problem with a script that I am writing and I believe it
is centered within a piece of jQuery code. I have some code like this
(simplified slightly):
    $.get('news/testfeed.xml', function(data) {
    $('record', data).each(function() {
var $link = $('<a></a>')
.attr('href', $('link', this).text())
.text($('name', this).text());
var $headline = $('<h4></h4>').append($link);
var $summary = $('<div></div>')
.addClass('summary')
.html($('description', this).text());
$('<div></div>')
.addClass('headline')
.append($headline)
.append($summary)
.appendTo($container);
});
I am using this to read the <title> and <description> elements of an
xml file which is the response from a RESTful request. I have put a
simplified version of the xml file below (just one record, and removed
the lom:classification stuff).
My problem, in a nutshell, is that the script works and displays data
when I look at it in Safari or Firefox 2.0 (Mac). However, when I look
at the same script running in Firefox 3 (Mac OS X or Windows) or IE7
then nothing seems to be returned at all. I tried replacing the
complex xml with a simple xml file like this:
==== simple xml ====
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record>
<title>
Title 1
</title>
<description>Description 1</description>
<teaser>Teaser 1</teaser>
</record>
</records>
==== simple xml ====
and this displays fine in all browsers. So my question is, why do the
browsers have different behaviour with respect to reading complex
elements out of xml data, and how do I get the data I need out of the
complex xml data reliably in other browsers?
Thanks for any advice you may be able to offer.
Ian.
--
==== xml ====
<?xml version="1.0" encoding="UTF-8"?>
<zs:searchRetrieveResponse xmlns="http://www.mystuff.co.uk"
xmlns:zs="http://www.loc.gov/zing/srw/" xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/
"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mystuff.co.uk schema/
content_node.xsd"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/
"
xmlns:lom="http://ltsc.ieee.org/xsd/LOM">
<zs:version>1.1</zs:version>
<zs:numberOfRecords>2319</zs:numberOfRecords>
<zs:records>
<zs:record>
<zs:recordSchema>info:srw/schema/1/dc-v1.1</
zs:recordSchema>
<zs:recordPacking>xml</zs:recordPacking>
<zs:recordData>
<srw_dc:dc xmlns:srw_dc="info:srw/schema/1/dc-schema">
<lom:metaMetadata>
<lom:identifier>
<lom:catalog>NS</lom:catalog>
<lom:entry>15296</lom:entry>
</lom:identifier>
</lom:metaMetadata>
<teaser>Introduction to the secondary Frameworks
section, including links to
background on the Frameworks as well as to
the English, mathematics, science
and ICT sections. </teaser>
<name>xxx</name>
<notes>updated</notes>
<taggingConfidence>Medium</taggingConfidence>
<dc:title>Secondary - Home Page</dc:title>
<dc:description>Introduction to the secondary
Frameworks section, including
links to background on the Frameworks as well
as to the English,
mathematics, science and ICT sections. </
dc:description>
<dc:identifier>nsonline.org.uk~22760~15296</
dc:identifier>
</srw_dc:dc>
</zs:recordData>
<zs:recordIdentifier>15296</zs:recordIdentifier>
<zs:recordPosition>1</zs:recordPosition>
</zs:record>
        </zs:records>
</zs:searchRetrieveResponse>
==== xml ====