1--TEST-- 2XMLWriter: libxml2 XML Writer, file buffer, flush 3--SKIPIF-- 4<?php if (!extension_loaded("xmlwriter")) print "skip"; ?> 5--FILE-- 6<?php 7 8$doc_dest = '001.xml'; 9$xw = xmlwriter_open_uri($doc_dest); 10xmlwriter_start_document($xw, '1.0', 'UTF-8'); 11xmlwriter_start_element($xw, "tag1"); 12xmlwriter_end_document($xw); 13 14// Force to write and empty the buffer 15$output_bytes = xmlwriter_flush($xw, true); 16echo file_get_contents($doc_dest); 17unset($xw); 18unlink($doc_dest); 19?> 20--EXPECT-- 21<?xml version="1.0" encoding="UTF-8"?> 22<tag1/> 23