File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
xmlwriter /
tests /
008.phpt
Revision
1.1.1.2 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 5 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
XMLWriter: libxml2 XML Writer DTD Element & Attlist
--SKIPIF--
<?php
if (!extension_loaded("xmlwriter")) die("skip");
?>
--FILE--
<?php
/* $Id: 008.phpt,v 1.1.1.2 2012/05/29 12:34:45 misho Exp $ */
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_dtd_entity($xw, "ent", false);
xmlwriter_text($xw, "val");
xmlwriter_end_dtd_entity($xw);
xmlwriter_write_dtd_entity($xw, "ent2", "val2");
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"?>
<!ENTITY ent "val">
<!ENTITY ent2 "val2">
<!ELEMENT sxe (elem1+, elem11, elem22*)>
<!ATTLIST sxe id CDATA #implied>
<!ELEMENT elem1 elem2*>
<!ATTLIST elem1 attr1 CDATA #required
attr2 CDATA #implied>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>