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