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