Text_Highlighter
[ class tree: Text_Highlighter ] [ index: Text_Highlighter ] [ all elements ]

Source for file XML.php

Documentation is available at XML.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4.  * XML renderer.
  5.  *
  6.  * Based on the HTML renderer by Andrey Demenev.
  7.  *
  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.
  13.  *
  14.  * @category   Text
  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$
  20.  * @link       http://pear.php.net/package/Text_Highlighter
  21.  */
  22.  
  23. /**
  24.  * @ignore
  25.  */
  26.  
  27. require_once 'Text/Highlighter/Renderer.php';
  28. require_once 'Text/Highlighter/Renderer/Array.php';
  29. require_once 'XML/Serializer.php';
  30.  
  31. /**
  32.  * XML renderer, based on Andrey Demenev's HTML renderer.
  33.  *
  34.  * @author     Stoyan Stefanov <ssttoo@gmail.com>
  35.  * @category   Text
  36.  * @package    Text_Highlighter
  37.  * @copyright  2006 Stoyan Stefanov
  38.  * @license    http://www.php.net/license/3_0.txt  PHP License
  39.  * @version    Release: 0.5.0
  40.  * @link       http://pear.php.net/package/Text_Highlighter
  41.  */
  42.  
  43. {
  44.  
  45.  
  46.     /**
  47.      * Options for XML_Serializer
  48.      *
  49.      * @access private
  50.      * @var array 
  51.      */
  52.     var $_serializer_options = array();
  53.  
  54.  
  55.     /**
  56.      * Resets renderer state
  57.      *
  58.      * Descendents of Text_Highlighter call this method from the constructor,
  59.      * passing $options they get as parameter.
  60.      *
  61.      * @access protected
  62.      */
  63.     function reset()
  64.     {
  65.         parent::reset();
  66.         if (isset($this->_options['xml_serializer'])) {
  67.             $this->_serializer_options $this->_options['xml_serializer'];
  68.         }
  69.     }
  70.  
  71.  
  72.     /**
  73.      * Signals that no more tokens are available
  74.      *
  75.      * @abstract
  76.      * @access public
  77.      */
  78.     function finalize()
  79.     {
  80.  
  81.         // call parent's finalize(), then serialize array into XML
  82.         parent::finalize();
  83.         $output = parent::getOutput();
  84.  
  85.         $serializer = new XML_Serializer($this->_serializer_options);
  86.         $result $serializer->serialize($output);
  87.         if ($result === true{
  88.             $this->_output $serializer->getSerializedData();
  89.         }
  90.     }
  91.  
  92.  
  93. }
  94.  
  95. /*
  96.  * Local variables:
  97.  * tab-width: 4
  98.  * c-basic-offset: 4
  99.  * c-hanging-comment-ender-p: nil
  100.  * End:
  101.  */
  102.  
  103. ?>

Documentation generated on Sat, 17 Dec 2011 07:30:21 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.