Hi again, I'm currently reading an .xml document using php dom. This is the code i'm using:

$doc = new domDocument();
$doc->load( 'images.xml' );
$images = $doc->getElementsByTagName( "image" );	
foreach($images as $value )
  {
  $filelocs = $value->getElementsByTagName("fileloc");
  $fileloc  = $filelocs->item(0)->nodeValue;
  echo "$fileloc";
  }

The error I keep getting is: "Parse error: syntax error, unexpected T_OBJECT_OPERATOR" in this line: "$fileloc = $filelocs->item(0)->nodeValue;"

Does anyone know what i'm doing wrong? Any help is appreciated

    Should item(0) be item[0] instead (square brackets)?

      I see no syntax errors here, unless this is PHP 4, which couldn't do the indirection needed to chain object operators off of method calls.

        thanks for the help guys 🙂 I found out the webserver is only running php 4.4.6 so that'll be the problem. I'll get php 5 installed ASAP

          Write a Reply...