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