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 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_reporting( E_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
?>