Given the following
<data type="new">
<time>1</time>
<time>2</time>
</data>
<data type="old">
<time>3</time>
<time>4</time>
</data
The goal being to type something along the following
<?php
$test = simplexml_load_file('http://....')
echo $test->data['type="old"']->time[0] //I want this to return 3
?>
and get the value of 3! I hate tried using attributes but I'm still on the search for the solution.
Thanks, JTC
The actually doc I'm trying to parse from
<data type="current observations">
<time-layout time-coordinate="local">
<start-valid-time period-name="current">2013-05-27T13:53:00-04:00</start-valid-time>
</time-layout>
</data>
I attempted the following but got an Invalid expression warning.
$weather = simplexml_load_file('http://...');
$time=$weather->xpath('//data[@type="current observations"]/"time-layout"/"start-valid- time"');
echo $time[0];