- simplexml_load_string: documentation ( source)
<?php
$xml=simplexml_load_string(<<<XML
<?xml version="1.0"?>
<root>
<element>
<feed id=" 9 ">
<title>test</title>
<table>feeds</table>
<link/>
<feed_type>API</feed_type>
<affiliate/>
<mwst>ja</mwst>
<tld>DE</tld>
<query/>
</feed>
<feed id=" 10 ">
<title>test</title>
<table>feeds</table>
<link/>
<feed_type>API</feed_type>
<affiliate/>
<mwst>ja</mwst>
<tld>DE</tld>
<query/>
</feed>
</element>
</root>
XML
);
function deleteNode($feed_id)
{
global $xml;
$parent=$xml->xpath('feed[@id=" '.$feed_id.' "]');
unset($parent);
}
echo "\n";
deleteNode("10");
echo $xml->asXML();