TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   SimpleXML (http://www.talkphp.com/absolute-beginners/2372-simplexml.html)

Haris 02-29-2008 03:14 AM

SimpleXML
 
1 Attachment(s)
I have the XML attached. I want to access the title of the entry node.

How do i do that?

Currently, I am doing the following to access title in a foreach loop of the XML->entry:

PHP Code:

$title $value->title[0]; 

but the values returned are:

PHP Code:

object(SimpleXMLElement)[27]
  public 
'@attributes' => 
    array
      
'type' => string 'text' (length=4)
  
string 'Red Jumpsuit Apparatus - Face Down' (length=34


DeMo 02-29-2008 05:00 AM

Try this code, it worked for me here using the XML file you supplied:
PHP Code:

$xml simplexml_load_file('Music.xml');
foreach (
$xml->entry as $entry) {
  echo 
$entry->title'<br />';




All times are GMT. The time now is 01:30 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0