PHP Classes

SimpleXML

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  SimpleXML  
Subject:SimpleXML
Summary:Problem parsing data
Messages:4
Author:Neil McGibbon
Date:2009-02-18 20:55:45
Update:2009-02-20 10:35:17
 

  1. SimpleXML   Reply   Report abuse  
Picture of Neil McGibbon Neil McGibbon - 2009-02-18 22:30:41
Hi there,

I have a question regarding SimpleXML - and why it deosn't retrieve all nodes, from the XML located at 'http://www.expekt.com/exportServlet'.

If I view the XML, I can see the data correctly. If I try view the XML after simplexml has loaded the data, not all of it displays. Please see my two entries below. This xml has many child nodes "game" with various child nodes.

THe first one is the XML for one "Game" node, the second past is the SimpleXML var_dump for the same "Game" node:

---------
XML
--------
<game id="3500090" date="20090218" time="2200">
<description>
<category id="TENMENINTINTATP" order="31300">ATP Tour</category>
Haas Tommy - Querrey Sam
</description>
<type id="0"/>
<alternatives>
<alternative odds="1.65" team="5659">1</alternative>
<alternative odds="0.00" team="5659">X</alternative>
<alternative odds="2.20" team="76376">2</alternative>
</alternatives>
</game>

---------
SimpleXML Object
---------

["game"]=>
array(2432) {
[0]=>
object(SimpleXMLElement)#2 (4) {
["@attributes"]=>
array(3) {
["id"]=>
string(7) "3500090"
["date"]=>
string(8) "20090218"
["time"]=>
string(4) "2200"
}
["description"]=>
object(SimpleXMLElement)#2434 (1) {
["category"]=>
string(8) "ATP Tour"
}
["type"]=>
object(SimpleXMLElement)#2435 (1) {
["@attributes"]=>
array(1) {
["id"]=>
string(1) "0"
}
}
["alternatives"]=>
object(SimpleXMLElement)#2436 (1) {
["alternative"]=>
array(3) {
[0]=>
string(1) "1"
[1]=>
string(1) "X"
[2]=>
string(1) "2"
}
}
}

As you can see, the atributes for "category" are missing, as is the text data for "description" as well as the atributes in each of the "alternative" nodes?

Can anyone shed any light on this at all?

Cheers,

Neil





There are 3 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.