Search code examples
phpxmldomxmlreader

Problem Reading XML DOM Element using PHP


I am failing! Here is my problem. I get a DOMElement Code:

$ref_cell = $new_row->childNodes->item($j);

I access the properties of said element Code: echo $ref_cell->nodeValue; Computer says... Quote:

Trying to get property of non-object...

I try Code:

echo $ref_cell;

Computer says... Quote:

Object of class DOMElement could not be converted to string...

Can anybody explain this?

Any insight at all would be helpful - I'm about to rip my face off and put my the keyboard thru the monitor...


Solution

  • It's possible that the row is empty and has no child nodes. I would start by checking to make sure each level of the Dom in question contains valid content.