1--TEST-- 2SimpleXML [interop]: simplexml_import_dom (old DOM) 3--EXTENSIONS-- 4simplexml 5dom 6--FILE-- 7<?php 8$dom = new domDocument; 9$dom->load(__DIR__."/book.xml"); 10if(!$dom) { 11 echo "Error while parsing the document\n"; 12 exit; 13} 14$s = simplexml_import_dom($dom); 15$books = $s->book; 16foreach ($books as $book) { 17 echo "{$book->title} was written by {$book->author}\n"; 18} 19?> 20--EXPECT-- 21The Grapes of Wrath was written by John Steinbeck 22The Pearl was written by John Steinbeck 23