I am just getting started with Simple XML
Parsing this data stored as $scorexml
SimpleXMLElement Object
(
[@attributes] => Array
(
[query-date-time] => 20141009T175358-0400
[query-string] => hidden
[hostname] => hidden.com
[result-count] => 1
[error-count] => 0
[total-count] => 9
[elapsed-time] => 13.0ms
)
[sports-content] => SimpleXMLElement Object
(
[sports-metadata] => SimpleXMLElement Object
(
[@attributes] => Array
(
[doc-id] => xt.21794675-Golf_Leaderboard_XML
[date-time] => 20140914T150400-0400
[language] => en-US
[document-class] => event-summary
[fixture-key] => leaderboard
[revision-id] => xt.21792812-Golf_Leaderboard_XML
)
[sports-title] => $8,000,000 The Tour Championship Leaderboard
[sports-content-codes] => SimpleXMLElement Object
(
[sports-content-code] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[code-type] => publisher
[code-key] => sportsnetwork.com
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[code-type] => priority
[code-key] => normal
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[code-type] => sport
[code-key] => 15027000
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[code-type] => league
[code-key] => l.pga.com
)
)
)
)
)
)
)
and trying to get
echo $scorexml->sports-content->sports-metadata['doc-id'];
but get an error when I try to echo it:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';'
Any help appreciated.