简体   繁体   中英

list all xml nodes to one dimension array?

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

使用xml2array( http://www.bin-co.com/php/scripts/xml2array/ ),您可以执行此操作

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM