home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / example1.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  684 b   |  32 lines

  1. <?PHP
  2. /**
  3. * XML_Beautifier example 1
  4. *
  5. * This example displays the basic usage.
  6. *
  7. * @author    Stephan Schmidt <schst@php.net>
  8. */
  9.     error_reporting( E_ALL );
  10.  
  11.     require_once 'XML/Beautifier.php';
  12.     $fmt = new XML_Beautifier();
  13.     $result = $fmt->formatFile('test.xml', 'test2.xml');
  14.     
  15.     if (PEAR::isError($result)) {
  16.         echo $result->getMessage();
  17.         exit();
  18.     }
  19.  
  20.     echo "<h3>Original file</h3>";
  21.     echo "<pre>";
  22.     echo htmlspecialchars(implode("",file('test.xml')));
  23.     echo "</pre>";
  24.         
  25.     echo    "<br><br>";
  26.     
  27.     echo "<h3>Beautified file</h3>";
  28.     echo "<pre>";
  29.     echo htmlspecialchars(implode("",file('test2.xml')));
  30.     echo "</pre>";
  31. ?>
  32.