Annotation of embedaddon/php/ext/xmlwriter/tests/009.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: XMLWriter: PI, Comment, CDATA
                      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: 009.phpt 216722 2006-07-19 18:50:51Z pajoye $ */
                     11: /*
                     12: Libxml 2.6.24 and up adds a new line after a processing instruction (PI)
                     13: */
                     14: $xw = xmlwriter_open_memory();
                     15: xmlwriter_set_indent($xw, TRUE);
                     16: xmlwriter_start_document($xw, NULL, "UTF-8");
                     17: xmlwriter_start_element($xw, 'root');
                     18: xmlwriter_write_attribute($xw, 'id', 'elem1');
                     19: xmlwriter_start_element($xw, 'elem1');
                     20: xmlwriter_write_attribute($xw, 'attr1', 'first');
                     21: xmlwriter_write_comment($xw, 'start PI');
                     22: xmlwriter_start_element($xw, 'pi');
                     23: xmlwriter_write_pi($xw, 'php', 'echo "hello world"; ');
                     24: xmlwriter_end_element($xw);
                     25: xmlwriter_start_element($xw, 'cdata');
                     26: xmlwriter_start_cdata($xw);
                     27: xmlwriter_text($xw, '<>&"');
                     28: xmlwriter_end_cdata($xw);
                     29: xmlwriter_end_element($xw);
                     30: xmlwriter_end_element($xw);
                     31: xmlwriter_end_element($xw);
                     32: xmlwriter_end_document($xw);
                     33: // Force to write and empty the buffer
                     34: $output = xmlwriter_flush($xw, true);
                     35: print $output;
                     36: ?>
                     37: --EXPECTF--
                     38: <?xml version="1.0" encoding="UTF-8"?>
                     39: <root id="elem1">
                     40:  <elem1 attr1="first">
                     41:   <!--start PI-->
                     42:   <pi><?php echo "hello world"; ?>%w</pi>
                     43:   <cdata><![CDATA[<>&"]]></cdata>
                     44:  </elem1>
                     45: </root>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>