xref: /PHP-8.3/ext/dom/tests/dom_xinclude.phpt (revision bd9f4fa6)
1--TEST--
2Test: Xinclude and Streams
3--EXTENSIONS--
4dom
5--SKIPIF--
6<?php
7in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
8?>
9--FILE--
10<?php
11$dom = new domdocument;
12
13$data = file_get_contents(__DIR__."/xinclude.xml");
14$reldir = str_replace(getcwd(),".",__DIR__);
15if (DIRECTORY_SEPARATOR == '\\') {
16    $reldir = str_replace('\\',"/", $reldir);
17}
18$data = str_replace('compress.zlib://ext/dom/tests/','compress.zlib://'.$reldir."/", $data);
19
20
21$dom->loadXML($data);
22$dom->xinclude();
23print $dom->saveXML()."\n";
24foreach ($dom->documentElement->childNodes as $node) {
25    print $node->nodeName."\n";
26}
27?>
28--EXPECTF--
29<?xml version="1.0"?>
30<foo xmlns:xi="http://www.w3.org/2001/XInclude">
31    <book xml:base="compress.zlib://%sbook.xml">
32  <title>The Grapes of Wrath</title>
33  <author>John Steinbeck</author>
34 </book><book xml:base="compress.zlib://%sbook.xml">
35  <title>The Pearl</title>
36  <author>John Steinbeck</author>
37 </book>
38 </foo>
39
40#text
41book
42book
43#text
44