XML parsing - more complicated XML documents

XML parsing - more complicated XML documents

I have the basic parsing down no problem - I can read in an XML document and use foreach and find combinations to get to the basic elements I want to get to.  The problem I'm running into is that I need to do more sophisticated parsing with multiple foreach statements:
 
<html>
<head>
<script>

$(document).ready(function() {

$('#example').click(function() {
$.get('http://localhost/receipts.xml', function(data) {
$('#output').empty();
$(data).find('Receipt').each(function() {
var $rec = $(this);
$(rec).find('SaleItem').each(funtion() {
var html2 = '<div id="receipt2">';
html2 += '<h1>foobar</h1>';
html2 += '<h2 id="POSItemID">' + $rec.find('POSItemID').text() + '</h2>';
html2 += '</div>';
$('#output').append($(html2));
});
});
});
});
});
</script>
...
 
The above gives me errors in IE and nothing in FireFox - how do I loop through top level elements, find child elements and then loop through children of those elements?
 
Here's snippets of the XML:
 
<Receipt>
...
<SaleItem>
<Text>Geomarlasun</Text>
<POSItemID>2247344068</POSItemID>
<Quantity>3</Quantity>
<UnitPrice>1.88</UnitPrice>
<ExtendedAmount>5.64</ExtendedAmount>
<ListPrice>8.50</ListPrice>
</SaleItem>
...
</Receipt>
<Receipt>
...
<SaleItem>
<Text>Geomarla Cel</Text>
<POSItemID>2246344063</POSItemID>
<ExtendedAmount>1.88</ExtendedAmount>
<ListPrice>8.50</ListPrice>
</SaleItem>
...
</Receipt>
 
I want to loop through all the Receipt elements, find the SaleItem elements, and then display each part of the SaleItem parts.
 
Any help would be MUCH appreciated!!