1--TEST-- 2XMLWriter: libxml2 XML Writer, comments 3--SKIPIF-- 4<?php 5if (!extension_loaded("xmlwriter")) die("skip"); 6if (!function_exists("xmlwriter_start_comment")) die("skip: libxml2 2.6.7+ required"); 7?> 8--FILE-- 9<?php 10/* $Id$ */ 11 12$doc_dest = '001.xml'; 13$xw = xmlwriter_open_uri($doc_dest); 14xmlwriter_start_document($xw, '1.0', 'UTF-8'); 15xmlwriter_start_element($xw, "tag1"); 16 17xmlwriter_start_comment($xw); 18xmlwriter_text($xw, 'comment'); 19xmlwriter_end_comment($xw); 20xmlwriter_write_comment($xw, "comment #2"); 21xmlwriter_end_document($xw); 22 23// Force to write and empty the buffer 24$output_bytes = xmlwriter_flush($xw, true); 25echo file_get_contents($doc_dest); 26unset($xw); 27unlink('001.xml'); 28?> 29===DONE=== 30--EXPECT-- 31<?xml version="1.0" encoding="UTF-8"?> 32<tag1><!--comment--><!--comment #2--></tag1> 33===DONE=== 34