Reputation: 1521
List all node as element of an array? my xml data:
<videos>
<video>
<id>1</id>
<title>Video 1</title>
<thumbnail>1.jpg</thumbnail>
</video>
<video>
<id>2</id>
<title>Video Number 2</title>
<thumbnail>1.jpg</thumbnail>
</video>
<video>
<id>3</id>
<title>Video Number 3</title>
<thumbnail>1.jpg</thumbnail>
</video>
</videos>
I want to list all node of xml as element of array.
Who can give me the solution.?
thanks
Upvotes: 0
Views: 340
Reputation: 191
Depending on what you need, there are many node_to_array functions in the DOM Document http://www.php.net/manual/en/book.dom.php . If you just need nodes->values nested then it can be very simple.
Upvotes: 1
Reputation: 4157
Using xml2array (http://www.bin-co.com/php/scripts/xml2array/) you can do this
Upvotes: 2