Exemplo n.º 1
0
<?php

/* $Id$ */
$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;
Exemplo n.º 2
0
VERIFY(xmlwriter_start_element($xml, "node"));
VERIFY(xmlwriter_start_cdata($xml));
VERIFY(xmlwriter_text($xml, "Raw text"));
VERIFY(xmlwriter_end_cdata($xml));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_element($xml, "node"));
VERIFY(xmlwriter_write_cdata($xml, "More CDATA"));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_comment($xml));
VERIFY(xmlwriter_text($xml, "Comments"));
VERIFY(xmlwriter_end_comment($xml));
VERIFY(xmlwriter_write_comment($xml, "More comments"));
VERIFY(xmlwriter_start_pi($xml, "lol"));
VERIFY(xmlwriter_end_pi($xml));
VERIFY(xmlwriter_write_pi($xml, "php", "print 'Hello world!';"));
VERIFY(xmlwriter_write_raw($xml, "<node>Raw XML</node>"));
VERIFY(xmlwriter_write_dtd($xml, "name", "publicID", "systemID", "subset"));
VERIFY(xmlwriter_start_dtd($xml, "name", "publicID", "systemID"));
VERIFY(xmlwriter_end_dtd($xml));
VERIFY(xmlwriter_start_dtd_element($xml, "name"));
VERIFY(xmlwriter_end_dtd_element($xml));
VERIFY(xmlwriter_write_dtd_element($xml, "name", "content"));
VERIFY(xmlwriter_start_dtd_attlist($xml, "name"));
VERIFY(xmlwriter_end_dtd_attlist($xml));
VERIFY(xmlwriter_write_dtd_attlist($xml, "name", "content"));
VERIFY(xmlwriter_start_dtd_entity($xml, "name", false));
VERIFY(xmlwriter_end_dtd_entity($xml));
VERIFY(xmlwriter_write_dtd_entity($xml, "name", "content", false, "publicid", "systemid", "ndataid"));
VERIFY(xmlwriter_end_document($xml));
var_dump(xmlwriter_flush($xml));
var_dump(xmlwriter_output_memory($xml));