I need to get the innerHTML of the maintext class name of a table tag. If I use: $dom = new SimpleXMLElement(file_get_contents($file));//line 87 $tables = $dom->xpath('//table[@class="maintext"]'); print_r($tables); PHP: I get: On the other hand if I use: DOMElement //SimpleXMLElement $dom = new DOMElement(file_get_contents($file)); // line 88 $table = $dom->xpath('//table[@class="maintext"]'); print_r($table); PHP: I get: