Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f055ac1baf83fd14827d33551c35bf9c > files > 4

php-pear-XML_Beautifier-1.2.2-3.mga4.noarch.rpm

<?PHP
/**
* XML_Beautifier example 2
*
* This example displays the formatString()
* method which can be used to beautify an XML string instead
* of a file.
*
* @author	Stephan Schmidt <schst@php.net>
*/
	error_reporting( E_ALL );

    $xmlString = '<xml><foo bar="tomato &amp; Cheese"/><argh>foobar<![CDATA[ Test
	Test ]]></argh></xml>';

    require_once 'XML/Beautifier.php';
    $fmt = new XML_Beautifier();
    $result = $fmt->formatString($xmlString);

    echo "<h3>Original string</h3>";
    echo "<pre>";
    echo htmlspecialchars($xmlString);
    echo "</pre>";
        
    echo    "<br><br>";
    
    echo "<h3>Beautified string</h3>";
    echo "<pre>";
    echo htmlspecialchars($result);
    echo "</pre>";
?>