xml ファイルから特定のデータをフェッチするつもりです。以前simple_load_file()
は xml ファイルを読み込んでオブジェクト要素を取得していましたが、それらにアクセスする方法がわかりません。xml ファイルは次のようになります。
<?mxl version="1.0">
<metaData>
<Application version="1.0" type="32">
<options>
<section name="A">
<description>...</description>
...
<section name="B">
....
</options>
</Application>
</metaData>
私のコード:
$xml = simplexml_load_file($url);
echo $xml->Application->version; // get the version but failed
echo $xml->Application->options->section...//I want to get the data from each section, but I don't know how to visit the elements.