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

Source for file example2.php

Documentation is available at example2.php

  1. <?PHP
  2. /**
  3. * XML_Beautifier example 2
  4. *
  5. * This example displays the formatString()
  6. * method which can be used to beautify an XML string instead
  7. * of a file.
  8. *
  9. @author    Stephan Schmidt <schst@php.net>
  10. */
  11.     error_reportingE_ALL );
  12.  
  13.     $xmlString '<xml><foo bar="tomato &amp; Cheese"/><argh>foobar<![CDATA[ Test
  14.     Test ]]></argh></xml>';
  15.  
  16.     require_once 'XML/Beautifier.php';
  17.     $fmt = new XML_Beautifier();
  18.     $result $fmt->formatString($xmlString);
  19.  
  20.     echo "<h3>Original string</h3>";
  21.     echo "<pre>";
  22.     echo htmlspecialchars($xmlString);
  23.     echo "</pre>";
  24.         
  25.     echo    "<br><br>";
  26.     
  27.     echo "<h3>Beautified string</h3>";
  28.     echo "<pre>";
  29.     echo htmlspecialchars($result);
  30.     echo "</pre>";
  31. ?>

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