473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Delete SimpleXml node by xpath?

21
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:
Expand|Select|Wrap|Line Numbers
  1. <maillist><user><time>2011</time><email>MUBnLmNvbQ==</email></user><user><time>2011</time><email>M0BnLmNvbQ==</email></user></maillist>
And here is the php:
Expand|Select|Wrap|Line Numbers
  1. $xml = simplexml_load_file('mail-list.xml');
  2.  
  3.     //Find if there is an email in the xml
  4.     $result = $xml->xpath('//email[contains(.,"'.base64_encode($email).'")]');
  5.     if ($result){ 
  6.     echo "Found".base64_decode($result[0]); 
  7.     }else{echo "No email found!";}
Thanks in advance.
Apr 2 '11 #1
0 1398

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Sumika | last post by:
Hello, I'm a newbie here, so don't know much friends. I've problem deleting my node at the tail, so could you all help me to solve my error,I worked on it for quite sometime but it just can't...
4
by: sugoi.sama | last post by:
hi, i'm having a hellish adventure with PHP5 i hope someone just can help me out on this... i'm desperate All i want to do, is to get the index of the returned elements, so i can acess them...
4
by: crmpicco | last post by:
I am trying to delete all 'PiccoOption' nodes that i do not need, i then want to put the document, with just one 'PiccoOption' into the form field 'document.form.optionNumber.value'. This code...
2
by: mathon | last post by:
hello, i thought i create a new topic for that because i deal with a certain problem. I have implemented all methods for a LinkdeList (for my sequence class) and tested all correct. Now i only...
16
by: sangram | last post by:
how to delete last node of a Linked list if you only know the address of last node. thanks sangram
11
by: hotice | last post by:
How to write code to delete a specific node in a single link list that takes O(1) time? £¨ link list uses pointers, not hash. £© That is, the time deleting a node is the same (independent from...
2
by: henryrhenryr | last post by:
Hi I know the title's a bit odd. I'm trying to set up an XQuery for which the xpath is set previously according to input parameters. If I was going to do this normally I'd do something like: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.