删除name为a23的节点
$dom = new DOMDocument();$dom->load("tour.xml");$xpath = new DOMXPath($dom);$query = "//hotspot[@name = 'a23']";$hots = $xpath->query($query)->item(0); $hots->parentNode->removeChild($hots);$dom->save('tour.xml');