xref: /PHP-7.3/ext/xmlwriter/tests/006.phpt (revision 782352c5)
1--TEST--
2XMLWriter: libxml2 XML Writer, startDTD/writeElementNS
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlwriter")) die("skip");
6?>
7--FILE--
8<?php
9
10$doc_dest = '001.xml';
11$xw = xmlwriter_open_uri($doc_dest);
12xmlwriter_start_dtd($xw, 'foo', NULL, 'urn:bar');
13xmlwriter_end_dtd($xw);
14xmlwriter_start_element($xw, 'foo');
15xmlwriter_write_element_ns($xw, 'foo', 'bar', 'urn:foo', 'dummy content');
16xmlwriter_end_element($xw);
17
18// Force to write and empty the buffer
19$output_bytes = xmlwriter_flush($xw, true);
20echo file_get_contents($doc_dest);
21unset($xw);
22unlink('001.xml');
23?>
24--EXPECT--
25<!DOCTYPE foo SYSTEM "urn:bar"><foo><foo:bar xmlns:foo="urn:foo">dummy content</foo:bar></foo>
26