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"); 9if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required"); 10?> 11--FILE-- 12<?php 13 14$xw = xmlwriter_open_memory(); 15xmlwriter_set_indent($xw, TRUE); 16xmlwriter_set_indent_string($xw, ' '); 17xmlwriter_start_document($xw, '1.0', "UTF-8"); 18xmlwriter_start_element($xw, 'root'); 19xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1'); 20xmlwriter_write_attribute_ns($xw, 'ns1','att1', 'urn:ns1', '<>"\'&'); 21xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&"); 22xmlwriter_end_element($xw); 23xmlwriter_start_element($xw, 'empty'); 24xmlwriter_full_end_element($xw); 25xmlwriter_full_end_element($xw); 26// Force to write and empty the buffer 27$output = xmlwriter_flush($xw, true); 28print $output; 29?> 30--EXPECT-- 31<?xml version="1.0" encoding="UTF-8"?> 32<root> 33 <ns1:child1 ns1:att1="<>"'&" xmlns:ns1="urn:ns1"> 34 <chars>special characters: <>"'&</chars> 35 </ns1:child1> 36 <empty></empty> 37</root> 38