Jump to content

Unable to read xml node's value by using dom parser

- - - - -

  • Please log in to reply
No replies to this topic

#1
thatsme

thatsme

    Programmer

  • Members
  • PipPipPipPip
  • 176 posts
Hi. I am trying to read value of xml documents' node, but always get errors like that: trying to get property of non-object in <server address> line <line number>. Here's my code:
$elements= $xmlDoc->getElementsByTagName("naujiena");
$commentsList = $elements->item(0)->getElementsByTagName("komentarai");
$elements2 = $commentsList->item(0)->getElementsByTagName("autorius");
[COLOR=#ff0000]$value = $elements2->item(0)->nodeValue;[/COLOR]
error occurs on red line. xml document's tree is followed correctly in code. Any help?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users