root/trunk/examples/TestCDataSetter.php

Revision 129, 0.9 kB (checked in by mikey, 1 year ago)

renamed XJConfLoader to XJConf

Line 
1 <?php
2 /**
3  * Example that shows how to use the cdata setter.
4  *
5  * @author  Stephan Schmidt <stephan.schmidt@schlund.de>
6  * @author  Frank Kleine <frank.kleine@schlund.de>
7  */
8 require_once '../XJConf/XJConf.php';
9 use net::xjconf::DefinitionParser;
10 use net::xjconf::XmlParser;
11 require 'Complex2.php';
12 /**
13  * Example that shows how to use the cdata setter.
14  *
15  * @package     XJConf
16  * @subpackage  examples
17  */
18 class TestCDataSetter
19 {
20     public static function main()
21     {
22         $tagParser = new DefinitionParser();
23         $defs      = $tagParser->parse(getcwd() . '/xml/defines-set-cdata.xml');
24         $conf      = new XmlParser();
25         $conf->setTagDefinitions($defs);
26
27         try {
28             $conf->parse(getcwd() . '/xml/test-set-cdata.xml');
29         } catch (Exception $e) {
30             echo $e->getTraceAsString();
31             exit(0);
32         }
33
34         $c = $conf->getConfigValue('complex');
35         var_dump($c);
36     }
37 }
38 TestCDataSetter::main();
39 ?>
Note: See TracBrowser for help on using the browser.