How would I get the last item (or any specific item for that matter) in a simplexml object? Assume you don't know how many nodes there will be.
ex.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/xsl.xml"?>
<obj
href="http://xml.foo.com/"
display="com.foo.bar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://obix.org/ns/schema/1.0"
>
<list name="data" of="HistoryRecord">
<obj>
<abstime name="timestamp" val="1876-11-10T00:00:00-08:00"></abstime>
<int name="energy_in_kwh" val="1234"></int>
<int name="energy_out_kwh" val="123456"></int>
</obj>
<obj>
<abstime name="timestamp" val="1876-11-10T00:15:00-08:00"></abstime>
<int name="energy_in_kwh" val="1335"></int>
<int name="energy_out_kwh" val="443321"></int>
</obj>
</list>
<int name="count" val="2"></int>
</obj>
And I want to grab the last <obj></obj>
chunk (or even just part of it).