ID:          42437
 Updated by:  [EMAIL PROTECTED]
 Reported By: guenther dot stadler at gmx dot net
-Status:      Open
+Status:      Bogus
 Bug Type:    SimpleXML related
 PHP Version: 5.2.3
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2007-08-27 08:23:56] guenther dot stadler at gmx dot net

Description:
------------
Elements of the array returned by xpath() cannot be deleted.
I can change those elements, but deleting is impossible.

How can I delete a node returned by xpath()? Is there a way to find out
where the node I found is within the whole xml tree?

Thanks, Günther.

Reproduce code:
---------------
<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<root>
 <movie>Movie One</movie>
 <movie>Movie Two</movie>
</root>
XML;

$xml = new SimpleXMLElement($xmlstr);

$movs = $xml->xpath('//movie');

// Trying to delete the reference returned by xpath
unset($movs[0]);

// $movs[0] = NULL; doesn't work either

// No changes
echo $xml->asXML();

?>


Expected result:
----------------
<?xml version="1.0" standalone="yes"?>
<root>
 <movie>Movie Two</movie>
</root>

Actual result:
--------------
<?xml version="1.0" standalone="yes"?>
<root>
 <movie>Movie One</movie>
 <movie>Movie Two</movie>
</root>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42437&edit=1

Reply via email to