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

  1. <?PHP
  2. /**
  3. * XML_Beautifier example 5
  4. *
  5. * This example displays the 'maxCommentLine'
  6. * option. It will split long comments into seperate lines
  7. * with a maximum length of 'maxCommentLine'.
  8. *
  9. * For the best results, you should always use this in
  10. * conjunction with normalizeComments.
  11. *
  12. * @author    Stephan Schmidt <schst@php.net>
  13. */
  14.     error_reporting( E_ALL );
  15.  
  16.     require_once 'XML/Beautifier.php';
  17.     
  18.     $options = array(
  19.                         "normalizeComments" => true,
  20.                         "maxCommentLine"    => 10
  21.                     );
  22.     
  23.     $fmt = new XML_Beautifier($options);
  24.     $result = $fmt->formatFile('test.xml', 'test2.xml');
  25.  
  26.     echo "<h3>Original file</h3>";
  27.     echo "<pre>";
  28.     echo htmlspecialchars(implode("",file('test.xml')));
  29.     echo "</pre>";
  30.         
  31.     echo    "<br><br>";
  32.     
  33.     echo "<h3>Beautified file</h3>";
  34.     echo "<pre>";
  35.     echo htmlspecialchars(implode("",file('test2.xml')));
  36.     echo "</pre>";
  37. ?>
  38.