Annotation of embedaddon/php/ext/xmlwriter/tests/OO_005.phpt, revision 1.1.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: OO_005.phpt 201860 2005-12-02 02:05:26Z iliaa $ */
11:
12: $doc_dest = '001.xml';
13: $xw = new XMLWriter();
14: $xw->openUri($doc_dest);
15: $xw->startDocument('1.0', 'UTF-8');
16: $xw->startElement("tag1");
17: $xw->startComment();
18: $xw->text('comment');
19: $xw->endComment();
20: $xw->writeComment("comment #2");
21: $xw->endDocument();
22:
23: // Force to write and empty the buffer
24: $output_bytes = $xw->flush(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>