Ben aşağıda gibi bir XML var
<Row><Cell ss:StyleID="s245"><Data ss:Type="String">ABSOLUTE</Data></Cell>
<Cell ><Data ss:Type="String">Yellow</Data></Cell>
<Cell ><Data ss:Type="String">Exist</Data></Cell>
<Cell ><Data ss:Type="Number">30</Data></Cell>
<Cell ss:StyleID="s258"/>
</Row>
<Row><Cell ss:StyleID="s229"><Data ss:Type="String">PART3</Data></Cell>
<Cell ><Data ss:Type="String">Part3 Description</Data></Cell>
<Cell ><Data ss:Type="String">Buy_Part</Data></Cell>
<Cell ><Data ss:Type="Number">0</Data></Cell>
<Cell ss:StyleID="s258"/>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="13.5"><Cell ss:StyleID="s245"><Data ss:Type="String">PART3</Data></Cell>
<Cell ><Data ss:Type="String">Part3 Description</Data></Cell>
<Cell ><Data ss:Type="String">Buy_Part</Data></Cell>
<Cell ><Data ss:Type="Number">0</Data></Cell>
<Cell ss:StyleID="s258"/>
</Row>
Ben Düğüm içine Değer ararken XML Düğümler silmek istiyorum.
Ben yukarıdaki örnekte Value "Part3" aramak istiyorum ve bu değeri içeren tam düğüm silmek istediğiniz örnek. Yani yalnızca çıkış aşağıdaki gibi olmalıdır
<Row><Cell ss:StyleID="s245"><Data ss:Type="String">ABSOLUTE</Data></Cell>
<Cell ><Data ss:Type="String">Yellow</Data></Cell>
<Cell ><Data ss:Type="String">Exist</Data></Cell>
<Cell ><Data ss:Type="Number">30</Data></Cell>
<Cell ss:StyleID="s258"/>
</Row>
Ben komut aşağıda yazdım
$doc = new DOMDOcument;
$doc->loadxml($xmldata);
$item_id = "PART3";
$xpath = new DOMXpath($doc);
foreach($xpath->query('//Row[Cell/Data="' . $item_id . '"]') as $node) {
$node->parentNode->removeChild($node);
}
echo $doc->savexml();
But it displays the complete XML without deleting.
Please Help Me how to delete The node by searching for the Value PART3 since the XML will be Very BIG and it contains lots of <ROW><CELL><DATA></Data></Cell><ROW>