OO_005.phpt 580 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. XMLWriter: libxml2 XML Writer, comments
  3. --EXTENSIONS--
  4. xmlwriter
  5. --FILE--
  6. <?php
  7. $doc_dest = 'OO_005.xml';
  8. $xw = new XMLWriter();
  9. $xw->openUri($doc_dest);
  10. $xw->startDocument('1.0', 'UTF-8');
  11. $xw->startElement("tag1");
  12. $xw->startComment();
  13. $xw->text('comment');
  14. $xw->endComment();
  15. $xw->writeComment("comment #2");
  16. $xw->endDocument();
  17. // Force to write and empty the buffer
  18. $output_bytes = $xw->flush(true);
  19. echo file_get_contents($doc_dest);
  20. unset($xw);
  21. unlink($doc_dest);
  22. ?>
  23. --EXPECT--
  24. <?xml version="1.0" encoding="UTF-8"?>
  25. <tag1><!--comment--><!--comment #2--></tag1>