1--TEST--
2Interop Test: Import from SimpleXML
3--EXTENSIONS--
4dom
5simplexml
6--FILE--
7<?php
8$s = simplexml_load_file(__DIR__."/book.xml");
9if(!$s) {
10  echo "Error while loading the document\n";
11  exit;
12}
13$dom = dom_import_simplexml($s);
14print $dom->ownerDocument->saveXML();
15
16// This should fail because it has been imported already above in legacy DOM
17try {
18    Dom\import_simplexml($s);
19} catch (TypeError $e) {
20    echo $e->getMessage(), "\n";
21}
22?>
23--EXPECT--
24<?xml version="1.0"?>
25<books>
26 <book>
27  <title>The Grapes of Wrath</title>
28  <author>John Steinbeck</author>
29 </book>
30 <book>
31  <title>The Pearl</title>
32  <author>John Steinbeck</author>
33 </book>
34</books>
35Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode
36