Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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_reporting( E_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
?>