maddogandnoriko Posted April 8, 2009 Share Posted April 8, 2009 I have an xml page loaded into a simplexml object, and have used xpath as to just work on the episode tags. $episode_data=$this->xml->xpath("/Data/Episode[id=.$tvdbID.]"); When I echo the value of 'SeasonNumber' ($episode->SeasonNumber) I get a number as expected. But if I add $episode->SeasonNumber to an array: $this->seasonList[] = (int)$episode->SeasonNumber[0]; It adds a simplexml object to the array not the number as echoed before, in the end I am trying to end up with a simple array of season #'s. I have tried to include tenough info but not sure. Thank you for any help, maddogandnoriko Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted April 8, 2009 Author Share Posted April 8, 2009 oops there is also a : $episode_data=$this->xml->xpath("/Data/Episode[id=.$tvdbID.]"); foreach ($episode_data as $episode){ in there. Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 8, 2009 Share Posted April 8, 2009 Not familiar with xpath, so no idea what your code is actually doing, but I do notice a lack of contents access instead of a node. Shouldn't you be access it's contents instead? $this->seasonList[] = $episode->SeasonNumber[0]->textContent; Would be good if you could post your actual code including the foreach, inside [ code] [/ code] tags and surrounded by <?php ?> tags for syntax highlighting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.