XML to JSON plugin problem
Hello,
I have been trying to get the jQuery.xml2json.js plugin to work for me with my own XML file. I have copied the example from
http://www.fyneworks.com/jquery/xml-to-json/#tab-Examples-RSS and edited it to what I thought would work for me but I just get a blank result. The XML file I am using is in this form;
<?xml version="1.0" encoding="UTF-8"?>
<srenf>
<record>
<reference>098467</reference>
<activity_header>HOUSING</activity_header>
</record>
<record>
<reference>098470</reference>
<activity_header>DOGS</activity_header>
</record>
...
</srenf>
here is my HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<script src="jquery-latest.js" type="text/javascript" language="javascript"></script>
<script src="jquery.xml2json.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" charset="utf-8">
$.get('SRTHSWK.xml', function(xml){
$('#test').html('');
var rss = $.xml2json(xml);
$.each(srenf.record.item, function(i, item){
$('#test').append('<p>'
+item.reference+'</p>');
});
});
</script>
<div id="test"></div>
</body>
</html>
Can anyone see where I am going wrong? Sorry I'm afraid I know very little about javascript/jquery I am just trying to figure out how to get a google visualization from some XML data; I don't have the luxury of being able to use any other method, and can only use XML as a data source. Thanks in advance for any ideas; I've tried changing various elements of the code and using debuggers but am not getting anywhere.