2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Based on the HTML renderer by Andrey Demenev.
8 * LICENSE: This source file is subject to version 3.0 of the PHP license
9 * that is available through the world-wide-web at the following URI:
10 * http://www.php.net/license/3_0.txt. If you did not receive a copy of
11 * the PHP License and are unable to obtain it through the web, please
12 * send a note to license@php.net so we can mail you a copy immediately.
15 * @package Text_Highlighter
16 * @author Stoyan Stefanov <ssttoo@gmail.com>
17 * @copyright 2006 Stoyan Stefanov
18 * @license http://www.php.net/license/3_0.txt PHP License
19 * @version CVS: $Id: XML.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
20 * @link http://pear.php.net/package/Text_Highlighter
27 require_once dirname(__FILE__).'/../Renderer.php';
28 require_once dirname(__FILE__).'/../Renderer/Array.php';
31 * XML renderer, based on Andrey Demenev's HTML renderer.
33 * @author Stoyan Stefanov <ssttoo@gmail.com>
35 * @package Text_Highlighter
36 * @copyright 2006 Stoyan Stefanov
37 * @license http://www.php.net/license/3_0.txt PHP License
38 * @version Release: 0.5.0
39 * @link http://pear.php.net/package/Text_Highlighter
42 class Text_Highlighter_Renderer_XML extends Text_Highlighter_Renderer_Array
47 * Options for XML_Serializer
52 var $_serializer_options = array();
56 * Resets renderer state
58 * Descendents of Text_Highlighter call this method from the constructor,
59 * passing $options they get as parameter.
66 if (isset($this->_options['xml_serializer'])) {
67 $this->_serializer_options = $this->_options['xml_serializer'];
73 * Signals that no more tokens are available
81 // call parent's finalize(), then serialize array into XML
83 $output = parent::getOutput();
85 $serializer = new XML_Serializer($this->_serializer_options);
86 $result = $serializer->serialize($output);
87 if ($result === true) {
88 $this->_output = $serializer->getSerializedData();
99 * c-hanging-comment-ender-p: nil