CodeIgniter Forums
How to use Php DOMDocument object in ci4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to use Php DOMDocument object in ci4 (/showthread.php?tid=75533)



How to use Php DOMDocument object in ci4 - ProfessionalCoder - 02-18-2020

$result is post parameter .I want to try but not working.

error: Class 'App\Controllers\DOMDocument' not found

$resultDocument = new DOMDocument();

$resultDocument->loadXML($result);


$stateNode = $resultDocument->getElementsByTagName("state")->item(2);


$status = "";

if( $statusNode != null )

  $status = $stateNode->nodeVal;

Thank you for helps.


RE: How to use Php DOMDocument object in ci4 - jreklund - 02-18-2020

Put a \ before to use native classes in PHP. new \DOMDocument();