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

  1. <?PHP
  2. /**
  3. * XML_Beautifier example 4
  4. *
  5. * This example displays the 'normalizeComments'
  6. * option. If it is set to true, multiline comments will
  7. * be replaced by a single line comment.
  8. *
  9. * @author    Stephan Schmidt <schst@php.net>
  10. */
  11.     error_reporting( E_ALL );
  12.  
  13.     require_once 'XML/Beautifier.php';
  14.     
  15.     $options = array(
  16.                         "normalizeComments" => true,
  17.                     );
  18.     
  19.     $fmt = new XML_Beautifier($options);
  20.     $result = $fmt->formatFile('test.xml', 'test2.xml');
  21.  
  22.     echo "<h3>Original file</h3>";
  23.     echo "<pre>";
  24.     echo htmlspecialchars(implode("",file('test.xml')));
  25.     echo "</pre>";
  26.         
  27.     echo    "<br><br>";
  28.     
  29.     echo "<h3>Beautified file</h3>";
  30.     echo "<pre>";
  31.     echo htmlspecialchars(implode("",file('test2.xml')));
  32.     echo "</pre>";
  33. ?>
  34.