xref: /PHP-8.3/ext/xmlwriter/tests/005.phpt (revision 9871a624)
1--TEST--
2XMLWriter: libxml2 XML Writer, comments
3--EXTENSIONS--
4xmlwriter
5--FILE--
6<?php
7
8$doc_dest = '005.xml';
9$xw = xmlwriter_open_uri($doc_dest);
10xmlwriter_start_document($xw, '1.0', 'UTF-8');
11xmlwriter_start_element($xw, "tag1");
12
13xmlwriter_start_comment($xw);
14xmlwriter_text($xw, 'comment');
15xmlwriter_end_comment($xw);
16xmlwriter_write_comment($xw, "comment #2");
17xmlwriter_end_document($xw);
18
19// Force to write and empty the buffer
20$output_bytes = xmlwriter_flush($xw, true);
21echo file_get_contents($doc_dest);
22unset($xw);
23unlink($doc_dest);
24?>
25--EXPECT--
26<?xml version="1.0" encoding="UTF-8"?>
27<tag1><!--comment--><!--comment #2--></tag1>
28