Reputation: 265
<?xml version="1.0" encoding="UTF-8" ?>
<iMon_Reporting version="1.0">
<DATA>active server pages</DATA>
<DATA>asp.net</DATA>
<DATA>asp.net applications</DATA>
<DATA>health service</DATA>
<DATA>health service management groups</DATA>
<DATA>logicaldisk</DATA>
<DATA>memory</DATA>
<DATA>network interface</DATA>
<DATA>paging file</DATA>
<DATA>process</DATA>
<DATA>processor</DATA>
<DATA>smtp server</DATA>
<DATA>system</DATA>
<DATA>web service</DATA>
</iMon_Reporting>
I need to put each one of these values in an element of an array. Normally I would just use
$(xml).find('DATA').each
But I can't seem to get this to work. Any suggestions?
Upvotes: 0
Views: 481
Reputation: 265
Here's what worked. I used the xmlDOM plugin found here: http://outwestmedia.com/jquery-plugins/xmldom/
and used this code:
var $xml = $.xmlDOM(xml);
$xml.find('DATA').each(function(){
alert($(this).text());
});
Upvotes: 1