Check out Scrivo

Do you want to try out Scrivo? Then here's a demo for you that does not just get your feet wet but lets you plunge right in.

Contact us

For more information, please contact us. We're happy to help you out!

Next Nov 6 Previous

Roads to Rome

You need to process an XML file using DOM. Which method(s) can you use to create a DOM object from the XML data. Choose al that apply.

A: DOMDocument::load()
B: DOMDocument::loadXML()
C: domxml_open_mem()
D: domxml_open_file()


You can use all functions to create a DOM object from XML data. The following code sample shows you some applications of each function:


$xmlFile = "data.xml";
$xmlData = file_get_contents($xmlFile);

$domA1 = new DomDocument();

$domA2 = DomDocument::load($xmlFile);

$domB1 = new DomDocument();

$domB2 = DomDocument::loadXML($xmlData);

$domC = domxml_open_mem($xmlData);

$domD = domxml_open_file($xmlFile);