Speed up development with full-stack environments for every branch.

Learn More

How to load a XML document from a file with DOMDocument class [PHP]

233 Runs 1370 Views 480 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php

/**
 * PHP DOM module
 * Loading a XML document from a file with DOMDocument class
 * 
 */
//create a new DOMDocument instance
$doc = new DOMDocument();
//loading a xml file
$doc->load('test.xml');

//format the output for nice display
$doc->formatOutput = true;

//to see the full output of the document 
echo '<pre>' . htmlentities($doc->saveXML(), ENT_COMPAT | ENT_HTML401, "ISO-8859-1") . '</pre>';
?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).