私は次の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;
}
?>
しかし、それはうまくいきません。
名前空間要素の子であるノードにアクセスするのを手伝ってくれませんか。
敬具