xref: /PHP-5.6/ext/xmlwriter/tests/OO_008.phpt (revision bc22352c)
1--TEST--
2XMLWriter: libxml2 XML Writer DTD Element & Attlist
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlwriter")) die("skip");
6?>
7--FILE--
8<?php
9/* $Id$ */
10
11$xw = new XMLWriter();
12$xw->openMemory();
13$xw->setIndent(TRUE);
14$xw->startDocument(NULL, "UTF-8");
15$xw->writeDtdElement('sxe', '(elem1+, elem11, elem22*)');
16$xw->writeDtdAttlist('sxe', 'id     CDATA  #implied');
17$xw->startDtdElement('elem1');
18$xw->text('elem2*');
19$xw->endDtdElement();
20$xw->startDtdAttlist('elem1');
21$xw->text("attr1  CDATA  #required\n");
22$xw->text('attr2  CDATA  #implied');
23$xw->endDtdAttlist();
24$xw->endDocument();
25// Force to write and empty the buffer
26$output = $xw->flush(true);
27print $output;
28?>
29--EXPECT--
30<?xml version="1.0" encoding="UTF-8"?>
31<!ELEMENT sxe (elem1+, elem11, elem22*)>
32<!ATTLIST sxe id     CDATA  #implied>
33<!ELEMENT elem1 elem2*>
34<!ATTLIST elem1 attr1  CDATA  #required
35attr2  CDATA  #implied>
36