Annotation of embedaddon/php/ext/xmlwriter/tests/007.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: XMLWriter: libxml2 XML Writer, Elements & Attributes
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("xmlwriter")) die("skip");
! 6: if (LIBXML_VERSION < 20629) die("skip: libxml2 2.6.29+ required");
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: /* $Id: 007.phpt 238660 2007-06-26 12:12:31Z tony2001 $ */
! 11:
! 12: $xw = xmlwriter_open_memory();
! 13: xmlwriter_set_indent($xw, TRUE);
! 14: xmlwriter_set_indent_string($xw, ' ');
! 15: xmlwriter_start_document($xw, '1.0', "UTF-8");
! 16: xmlwriter_start_element($xw, 'root');
! 17: xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1');
! 18: xmlwriter_start_attribute_ns($xw, 'ns1', 'att1', 'urn:ns1');
! 19: xmlwriter_text($xw, 'a&b');
! 20: xmlwriter_end_attribute($xw);
! 21: xmlwriter_write_attribute($xw, 'att2', "double\" single'");
! 22: xmlwriter_start_attribute_ns($xw, 'ns1', 'att2', 'urn:ns1');
! 23: xmlwriter_text($xw, "<>\"'&");
! 24: xmlwriter_end_attribute($xw);
! 25: xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&");
! 26: xmlwriter_end_element($xw);
! 27: xmlwriter_end_document($xw);
! 28: // Force to write and empty the buffer
! 29: $output = xmlwriter_flush($xw, true);
! 30: print $output;
! 31: ?>
! 32: --EXPECT--
! 33: <?xml version="1.0" encoding="UTF-8"?>
! 34: <root>
! 35: <ns1:child1 ns1:att1="a&b" att2="double" single'" ns1:att2="<>"'&" xmlns:ns1="urn:ns1">
! 36: <chars>special characters: <>"'&</chars>
! 37: </ns1:child1>
! 38: </root>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>