xref: /PHP-8.3/ext/xmlwriter/tests/012.phpt (revision 74859783)
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--EXTENSIONS--
7xmlwriter
8--FILE--
9<?php
10
11$xw = xmlwriter_open_memory();
12xmlwriter_set_indent($xw, TRUE);
13xmlwriter_set_indent_string($xw, '   ');
14xmlwriter_start_document($xw, '1.0', "UTF-8");
15xmlwriter_start_element($xw, 'root');
16xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1');
17xmlwriter_write_attribute_ns($xw, 'ns1','att1', 'urn:ns1', '<>"\'&');
18xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&");
19xmlwriter_end_element($xw);
20xmlwriter_start_element($xw, 'empty');
21xmlwriter_full_end_element($xw);
22xmlwriter_full_end_element($xw);
23// Force to write and empty the buffer
24$output = xmlwriter_flush($xw, true);
25print $output;
26?>
27--EXPECT--
28<?xml version="1.0" encoding="UTF-8"?>
29<root>
30   <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
31      <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
32   </ns1:child1>
33   <empty></empty>
34</root>
35