LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 10-28-2005, 01:02 AM   #1
catzilla
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Rep: Reputation: 0
Question how could I delete duplicates entries in xml using php


I want to use php script to to delete duplicate entries (except the original one) from xml file like this example


from

######################################

<?xml version="1.0" encoding="ISO-8859-1"?><markers>

<marker
defacer="TroJaN"
system="Win 2003"
/>

<marker
defacer="TroJaN"
system="Win 2003"
/>

<marker
defacer="TroJaN"
system="Win 2003"
/>

<marker
defacer="TroJaN"
system="Linux"
/>

<marker
defacer="Team-evil"
system="Linux"
/>

</markers>

###################################

to

###################################

<?xml version="1.0" encoding="ISO-8859-1"?><markers>

<marker
defacer="TroJaN"
system="Win 2003"
/>

<marker
defacer="TroJaN"
system="Linux"
/>

<marker
defacer="Team-evil"
system="Linux"
/>

</markers>

####################################

any approach please ? thanks in advance
 
Old 10-28-2005, 12:28 PM   #2
tedfordgif
Member
 
Registered: Dec 2003
Posts: 43

Rep: Reputation: 15
It looks like your best bet is http://us3.php.net/manual/en/ref.simplexml.php

Similar to Example 3, you would iterate through an array. You can then use another array/hash to store the unique values.
 
Old 10-30-2005, 08:08 PM   #3
catzilla
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks

tedfordgif thanks for your reply I'll try that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to delete duplicates entries in xml file using sed/awk/sort ? catzilla Linux - Software 1 10-28-2005 03:57 PM
PHP w/ XML ridertech Linux - Software 0 05-05-2004 03:50 AM
Delete all entries in the calendar in Evolution TheSpork Linux - Software 0 04-16-2004 09:51 AM
Php Vs. Xml zetsui Programming 4 02-18-2004 01:57 PM
PHP and XML Bill Barrington Linux - Software 0 06-22-2003 09:08 PM


All times are GMT -5. The time now is 01:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration