summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/tests/008.phpt
blob: 17e0eab5fa17f8e257ca7510a68ec370d72f1e8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
XMLWriter: libxml2 XML Writer DTD Element & Attlist
--SKIPIF--
<?php 
if (!extension_loaded("xmlwriter")) die("skip"); 
if (!function_exists("xmlwriter_start_comment")) die("skip: libxml2 2.6.7+ required");
?>
--FILE--
<?php 
/* $Id$ */

$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_write_dtd_element($xw, 'sxe', '(elem1+, elem11, elem22*)');
xmlwriter_write_dtd_attlist($xw, 'sxe', 'id     CDATA  #implied');
xmlwriter_start_dtd_element($xw, 'elem1');
xmlwriter_text($xw, 'elem2*');
xmlwriter_end_dtd_element($xw);
xmlwriter_start_dtd_attlist($xw, 'elem1');
xmlwriter_text($xw, "attr1  CDATA  #required\n");
xmlwriter_text($xw, 'attr2  CDATA  #implied');
xmlwriter_end_dtd_attlist($xw);
xmlwriter_end_document($xw);
// Force to write and empty the buffer
$output = xmlwriter_flush($xw, true);
print $output;
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT sxe (elem1+, elem11, elem22*)>
<!ATTLIST sxe id     CDATA  #implied>
<!ELEMENT elem1 elem2*>
<!ATTLIST elem1 attr1  CDATA  #required
attr2  CDATA  #implied>