I have this xml document.
<search-results>
<physician>
<name>some name</name>
<address>
<street>some street</street>
<city>some city</city>
<state>some state</state>
<zip-code>some zip</zip-code>
</address>
<phone>some phone</phone>
<url>some url</url>
<logos>
<logo type="1">logo1</logo>
<logo type="2">logo2</logo>
</logos>
</physician>
</search-results>
I am able to list physicians that have a logo of type 1 using this code.
$(results).find('physician').each(function () {
var $physician = $(this);
var logos = $physician.children('logos');
var logo = logos.children('logo');
if (logo.attr('type') == "1")
{
var html = '<h3>' + $physician.children('name').text() + '</h3>';
html += '<p>' + $physician.children('logos').children('logo').text() + '</p>';
html += '<p>' + logo.attr('type') + '</p>';
$('#results').append(html);
}
});
However, not all physicians have both logos.
I need to be able to list physicians that have a logo with an id of 1, physicians that have an id of 2 and then physicians that have both logos. I am having trouble finding the physicians that have both logos 1 and 2. Can anyone point me in the right direction?