Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?PHP
2
/**
3
 * This example shows how to add a DocType Declaration to the XML document
4
 *
5
 * @author Stephan Schmidt <schst@php.net>
6
 */
7
error_reporting(E_ALL);
8
 
9
require_once 'XML/Serializer.php';
10
 
11
$options = array(
12
                    'indent'     => '    ',
13
                    'linebreak'  => "\n",
14
                    'addDecl'    => true,
15
                    'addDoctype' => true,
16
                    'doctype'    => array(
17
                                            'uri' => 'http://pear.php.net/dtd/package-1.0',
18
                                            'id' => '-//PHP//PEAR/DTD PACKAGE 0.1'
19
                                         )
20
                );
21
 
22
$serializer = new XML_Serializer($options);
23
 
24
$foo = PEAR::raiseError('Just a test', 1234);
25
 
26
$result = $serializer->serialize($foo);
27
 
28
if( $result === true ) {
29
    echo '<pre>';
30
    echo htmlentities($serializer->getSerializedData());
31
    echo '</pre>';
32
}
33
?>