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