Annotation of embedaddon/php/ext/xmlwriter/tests/003.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: XMLWriter: libxml2 XML Writer, membuffer, flush, attribute
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("xmlwriter")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: /* $Id: 003.phpt 201860 2005-12-02 02:05:26Z iliaa $ */
! 8:
! 9: $doc_dest = '001.xml';
! 10: $xw = xmlwriter_open_memory($doc_dest);
! 11: xmlwriter_start_document($xw, '1.0', 'UTF-8');
! 12: xmlwriter_start_element($xw, "tag1");
! 13:
! 14:
! 15: $res = xmlwriter_start_attribute($xw, 'attr1');
! 16: xmlwriter_text($xw, "attr1_value");
! 17: xmlwriter_end_attribute($xw);
! 18:
! 19: xmlwriter_write_attribute($xw, "att2", "att2_value");
! 20: xmlwriter_text($xw, "Test text for tag1");
! 21: $res = xmlwriter_start_element($xw, 'tag2');
! 22: if ($res < 1) {
! 23: echo "StartElement context validation failed\n";
! 24: exit();
! 25: }
! 26: xmlwriter_end_document($xw);
! 27:
! 28: // Force to write and empty the buffer
! 29: echo xmlwriter_flush($xw, true);
! 30: ?>
! 31: ===DONE===
! 32: --EXPECT--
! 33: <?xml version="1.0" encoding="UTF-8"?>
! 34: <tag1 attr1="attr1_value" att2="att2_value">Test text for tag1<tag2/></tag1>
! 35: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>