Hey everybody,
I have a question about xpath and arrays. What I was wondering was if it is possible to use xpath on some simpleXML and have it return an associative array of node names and their values. For example, say I have the following XML:
<element1 page="1">blah</element1>
<element2 page="1">blah blah</element2>
<element3 page="2">blah</element3>
<element4 page="3">blah blah</element4>
Now if I were to go $xml->xpath('//node()[@page="1"]');
then it would return an array like the following:
array( 0 => 'blah' , 1 => 'blah blah' );
Is it possible to get an array similar to the one below?
array( element1 => 'blah' , element2 => 'blah blah' );
Thanks for the help!