root/trunk/examples/engine_dom.php

Revision 27, 1.2 kB (checked in by argh, 3 years ago)

Added some docs; Tweaked output.

Line 
1 <?php
2 /**
3  * Quickstart example
4  *
5  * @access        public
6  * @package        patXMLPretty
7  * @subpackage    Examples
8  * @author        Sebastian Mordziol <argh@php-tools.net>
9  * @license        LGPL, see license.txt for details
10  * @link        http://www.php-tools.net
11  */
12
13     /**
14      * Main examples prepend file, needed *only* for the examples framework!
15      */
16     include_once 'patExampleGen/prepend.php';
17     $exampleGen->displayHead( 'Example' );
18
19
20     // EXAMPLE START ------------------------------------------------------
21
22     /**
23      * The patXMLPretty main class
24      */
25     require_once $neededFiles['patXMLPretty'];
26
27     /**
28      * patErrorManager class
29      */
30     require_once $neededFiles['patErrorManager'];
31
32
33     // create a new XML pretty object
34     $pretty =& new patXMLPretty;
35
36     // create the engine we want to use
37     $engine =& $pretty->createEngine( 'DOM' );
38
39     // give patXMLPretty the engine to use
40     $pretty->setEngine( $engine );
41
42     // highlight a file
43     $highlighted = $pretty->parseFile( 'data/sitemap.xml' );
44     if( patErrorManager::isError( $highlighted ) ) {
45         die( $highlighted->getMessage() );
46     }
47
48     // display the highlighted source
49     displaySection( 'Highlighted source', $highlighted );
50
51
52     // EXAMPLE END ------------------------------------------------------
53     $exampleGen->displayFooter();
54 ?>
55
Note: See TracBrowser for help on using the browser.