Page 1 of 1

[SOLVED] List XML elements

Posted: Tue Jan 05, 2010 4:32 am
by Ragnis
I have the following XML:

Code: Select all

<root>
    <set key="sth" />
    <uname>Somebody</uname>
    <container>
        <uname>Somebody</uname>
        <container>
            Some content
        </container>
    </container>
    Some text
</root>
Now i need a regex to get list of the elements:

Code: Select all

root,set,uname,container
or it can be also an array.

Re: List XML elements

Posted: Tue Jan 05, 2010 12:14 pm
by Christopher
Have you tried SimpleXML first?

Re: List XML elements

Posted: Sat Jan 23, 2010 7:24 am
by Ragnis
I got it working myself.

Code: Select all

<([a-z:]+)(.+)?( /)?>