I can\'t seem to figure this one out. I have the following XML file:
I'd suggest the following (PHP using ext/simplexml and XPath):
$name = 'Shiny Red';
$xml = simplexml_load_string('
');
$nodes = $xml->xpath(sprintf('/targets/showcases/building[@name="%s"]', $name);
if (!empty($nodes)) {
printf('At least one building named "%s" found', $name);
} else {
printf('No building named "%s" found', $name);
}