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

Source for file example5.php

Documentation is available at example5.php

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

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