Re: How to obtain unique XML Elements
| From: | @ Edwin | Date: | Mon, 25 Nov 2002 17:22:25 +0000 |
| Subject: | Re: How to obtain unique XML Elements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125955@lists.php.net to get a copy of this message | ||
Hello,
"David Pratt" <fairwinds@shaw.ca> wrote:
> Anyone have a simple technique for obtaining a unique list of elements
from
> an XML file?
>
> Am looking for something that will identify the first opening tag ie
> <thistag> and the single tag <anothertag/> so that I get an array of tags
> that I can print out. Having a bit of trouble with regex to get something
> to work.
>
> Basic idea I had is to open file, read through each line with regex, add
> matches to array, and then do unique elements of array and write to
another
> file.
>
> Is there a better way?
Yes. Have you checked the manual? :)
http://www.php.net/manual/en/ref.xml.php
- E