[英]How to export from xml
I have a xml file file name is file.xml This is content 我有一个xml文件,文件名为file.xml,这是内容
<PAD_INFO>
<ITEMS>
<Item>
<PAD_URL>http://www.instant-navigator.com/instantn_pad.xml</PAD_URL>
<Antivirus_Report_URL>http://instantnavigator-for-onenote.extramind-systems.qarchive.org/antivirusreport.html</Antivirus_Report_URL>
<Last_Checking_Date>2010-06-28 05:09:18</Last_Checking_Date>
</Item>
<Item>
<PAD_URL>http://www.mishelpers.com/network_monitor/netmonpro.xml</PAD_URL>
<Antivirus_Report_URL>http://alchemy-network-monitor-pro.m-i-s-helpers.qarchive.org/antivirusreport.html</Antivirus_Report_URL>
<Last_Checking_Date>2010-06-03 08:00:43</Last_Checking_Date>
</Item>
<Item>
<PAD_URL>http://www.pdacraft.com/pad/pdacraft_paint_pad.xml</PAD_URL>
<Antivirus_Report_URL>http://pdacraft-paint.pdacraft.qarchive.org/antivirusreport.html</Antivirus_Report_URL>
<Last_Checking_Date>2010-06-05 01:34:11</Last_Checking_Date>
</Item>
</ITEMS>
</PAD_INFO>
Please help me export all file .xml from pad_url tag Use php 请帮助我从pad_url标记导出所有文件.xml使用php
Thanks 谢谢
As SaC said... SimpleXml is probably the easiest answer here. 正如SaC所说的……SimpleXml可能是这里最简单的答案。
// assume $xmlstring is the xml you posted
$xml = new SimpleXmlElement($xmlstring);
$urls = $xml->xpath('//PAD_URL');
foreach($urls as $url)
{
// when used in a string contect $url will be the text value
echo $url;
// however its still really the object so for example if you needed te attributes
$attributes = $url->attributes();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.