954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Delete SimpleXml node by xpath?

Hello,
I have a php code that can find a child node in my xml file, And my problem is that I want to delete the specific user when I find the child node.
How can I implement it here?

mail-list.xml:

<maillist><user><time>2011</time><email>MUBnLmNvbQ==</email></user><user><time>2011</time><email>M0BnLmNvbQ==</email></user></maillist>


And here is the php:

$xml = simplexml_load_file('mail-list.xml');
 
    //Find if there is an email in the xml
    $result = $xml->xpath('//email[contains(.,"'.base64_encode($email).'")]');
    if ($result){ 
    echo "Found".base64_decode($result[0]); 
    }else{echo "No email found!";}
agam360
Light Poster
27 posts since Jun 2009
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: