开发者

Parsing XML data using PHP

开发者 https://www.devze.com 2023-01-04 17:39 出处:网络
I need to parse all data from below XML file. Please guide me how can I do it? How can I put data into a separate variables or array. Like, the value of <p:productid> tag into $pid and value of

I need to parse all data from below XML file. Please guide me how can I do it? How can I put data into a separate variables or array. Like, the value of <p:productid> tag into $pid and value of <p1:devices> into $pdevice?

Here is a sample file:

<?xml version="1.0" encoding="UTF-8"?>
  <p:application>


      <p1:devices>
         <p1:device>First device</p1:device>
         <p1:device>Second Device</p1:device>
     </p1:devices>    

 </p:versions> 
</开发者_如何学Cp:application>


You can use the SimpleXML for that.

Here is a good tutorial to get you started:

Introduction To SimpleXML With PHP

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号