xref: /PHP-8.0/ext/xmlwriter/tests/012.phpt (revision 74235ca5)
1--TEST--
2XMLWriter: libxml2 XML Writer, full_end_element function
3--CREDITS--
4Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
5#testfest PHPSP on 2014-07-05
6--SKIPIF--
7<?php
8if (!extension_loaded("xmlwriter")) die("skip");
9?>
10--FILE--
11<?php
12
13$xw = xmlwriter_open_memory();
14xmlwriter_set_indent($xw, TRUE);
15xmlwriter_set_indent_string($xw, '   ');
16xmlwriter_start_document($xw, '1.0', "UTF-8");
17xmlwriter_start_element($xw, 'root');
18xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1');
19xmlwriter_write_attribute_ns($xw, 'ns1','att1', 'urn:ns1', '<>"\'&');
20xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&");
21xmlwriter_end_element($xw);
22xmlwriter_start_element($xw, 'empty');
23xmlwriter_full_end_element($xw);
24xmlwriter_full_end_element($xw);
25// Force to write and empty the buffer
26$output = xmlwriter_flush($xw, true);
27print $output;
28?>
29--EXPECT--
30<?xml version="1.0" encoding="UTF-8"?>
31<root>
32   <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
33      <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
34   </ns1:child1>
35   <empty></empty>
36</root>
37