我有以下 xml 代码:
文件 1.xml
<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns="">
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<dsAanbod>
<Pand diffgr:id="Pand1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<PandID>231384</PandID>
</Pand>
</dsAanbod>
</diffgr:diffgram>
</DataSet>
我如何读取之间的数据
我有以下php代码
<?php
$xml_url = "1.xml";
$xml = simplexml_load_file($xml_url);
foreach ($xml as $entry){
//Use that namespace
$namespaces = $entry->getNameSpaces(true);
//Now we don't have the URL hard-coded
$diffgr = $entry->children($namespaces['diffgr']);
echo $diffgr->diffgram->dsAanbod->Pand->PandID;
}
?>
但这不起作用。
有人可以帮助我访问一个节点,它是命名空间元素的子节点。
亲切的问候