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

  1. <?PHP
  2. /**
  3. * XML_Beautifier example 3
  4. *
  5. * This example displays the 'caseFolding'
  6. * option. It can be used to convert all tags
  7. * and attribute names to upper case or lower
  8. * case. Use the 'caseFoldingTo' options to
  9. * to specify the case.
  10. *
  11. * @author    Stephan Schmidt <schst@php.net>
  12. */
  13.     error_reporting( E_ALL );
  14.  
  15.     require_once 'XML/Beautifier.php';
  16.     
  17.     $options = array(
  18.                         "caseFolding" => true,
  19.                         "caseFoldingTo" => "uppercase"
  20.                     );
  21.     
  22.     $fmt = new XML_Beautifier($options);
  23.     $result = $fmt->formatFile('test.xml', 'test2.xml');
  24.  
  25.     echo "<h3>Original file</h3>";
  26.     echo "<pre>";
  27.     echo htmlspecialchars(implode("",file('test.xml')));
  28.     echo "</pre>";
  29.         
  30.     echo    "<br><br>";
  31.     
  32.     echo "<h3>Beautified file</h3>";
  33.     echo "<pre>";
  34.     echo htmlspecialchars(implode("",file('test2.xml')));
  35.     echo "</pre>";
  36. ?>
  37.