summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/tests/008.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xmlwriter/tests/008.phpt')
-rw-r--r--ext/xmlwriter/tests/008.phpt35
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/xmlwriter/tests/008.phpt b/ext/xmlwriter/tests/008.phpt
new file mode 100644
index 0000000..17e0eab
--- /dev/null
+++ b/ext/xmlwriter/tests/008.phpt
@@ -0,0 +1,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>