XML_Serializer
[ class tree: XML_Serializer ] [ index: XML_Serializer ] [ all elements ]

Source for file serializeWithDtd.php

Documentation is available at serializeWithDtd.php

  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. ?>

Documentation generated on Mon, 11 Mar 2019 14:14:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.