我正在尝试从XML文件中获取内容,但它并没有真正返回所有内容。以下是XML网址:
提取物:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">KENT_VRTG_O_DAT</title>
<id>https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT</id>
<updated>2014-02-19T08:05:16Z</updated>
<link rel="self" title="KENT_VRTG_O_DAT" href="KENT_VRTG_O_DAT" />
<entry>
<id>https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('0001ES')</id>
<title type="text"></title>
<updated>2014-02-19T08:05:16Z</updated>
<author>
<name />
</author>
<link rel="edit" title="KENT_VRTG_O_DAT" href="KENT_VRTG_O_DAT('0001ES')" />
<category term="opendata.rdw.VRTG.Open.Data.KENT_VRTG_O_DAT" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Aantalcilinders m:type="Edm.Int16">4</d:Aantalcilinders>
<d:Aantalstaanplaatsen m:type="Edm.Int16" m:null="true" />
<d:Aantalzitplaatsen m:type="Edm.Int16" m:null="true" />
<d:BPM m:type="Edm.Int32" m:null="true" />
您可以在entry->content
下看到,<m:properties>
内有我需要的所有信息。但是,当我print_r
内容时,[content]
部分就是这样:
SimpleXMLElement Object
(
[@attributes] => Array
(
[type] => application/xml
)
)
我做错了什么?
提前致谢。
我已经检查过以前的答案,但我似乎找不到任何适合我的方法。这是我正在使用的代码:
$data->entry->content->m->children('d', true)->Aantalcilinders
$data->entry->content->children('m', true)->children('d', true)->Aantalcilinders