mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
31 lines
680 B
PHP
31 lines
680 B
PHP
<?php
|
|
dl('xmlwriter.so');
|
|
|
|
$xw = xmlwriter_open_memory();
|
|
xmlwriter_set_indent($xw, 1);
|
|
$res = xmlwriter_set_indent_string($xw, ' ');
|
|
|
|
xmlwriter_start_document($xw, '1.0', 'UTF-8');
|
|
// A first element
|
|
xmlwriter_start_element_ns($xw,'prefix', 'books', 'uri');
|
|
xmlwriter_start_attribute($xw, 'isbn');
|
|
|
|
/* Uncomment this line if you have libxml 2.6.17 or CVS version
|
|
after 2005/02/22
|
|
earlier versions segfault
|
|
*/
|
|
/*
|
|
xmlwriter_start_attribute_ns($xw, 'prefix', 'isbn', 'uri');
|
|
xmlwriter_end_attribute($xw);
|
|
*/
|
|
xmlwriter_end_attribute($xw);
|
|
|
|
xmlwriter_text($xw, 'book1');
|
|
xmlwriter_end_element($xw);
|
|
|
|
xmlwriter_end_document($xw);
|
|
$out = xmlwriter_output_memory($xw, 0);
|
|
|
|
echo $out;
|
|
|