I have some XML data and I am trying to access some elements. The structure of the data is given below (using print_r ($ data)) I $ data-> gt; {'Parent'} - & gt; Title,
, but if I select $ data-> Trying to get the value of href using {'parent'} - & gt; Link [0] - & gt; {'@ Attributes'} - & gt; Href
.. this works .. Any ideas? Simple Examination Object ([@attributes] => Array ([children] => 29 [module] = & gt; 0) [
Thanks
Title] = & gt; [title] = & gt; array ([0] = & gt; simple assemble object ([@ features] = & gt; array ([href] = & gt; data.php? Id = 2322 [Rel] => self [type] => application / XML) [1] = & gt; Simple XML object ([@wants] = & gt; array ([href] = & gt; data. Php? Id = 2342 [rel] => optional [type] = & gt; text / html) [original] = & gt; simple assemble object ([@ attribute EY] => Array ([children] => 6 [Module] => 1] [Title] => Head [Link] => Array ([0] = & gt; Simple XML object ([@attributes] = & gt; Array ([href] = & gt; /data.php?id=5763 [rel] => self [type] => applications / XML) [1 ] = & Gt; Simple assemblement object ([@attributes] => array ([href] = & gt; / data.php? Id = 2342 [rel] => optional [type] = & gt; text / Html))))
)
check out , Especially on the misleading var_dump
( print_r
) comment out of SimpleXML Put
It has been said that IIRC should work in your example:
$ data-> {'Parent'} - & gt; Links [0] ['Href']
(i.e. properties can be used with standard array markings - this definitely works on single elements, not sure that this Elements works with additional indexes in the archive.)
Comments
Post a Comment