summaryrefslogtreecommitdiff
path: root/lib/phptal/PHPTAL/Dom/DocumentBuilder.php
blob: c08587f9a0fe4c1fcc4d6d3d3bba59f6f9a1293d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
 * PHPTAL templating engine
 *
 * PHP Version 5
 *
 * @category HTML
 * @package  PHPTAL
 * @author   Laurent Bedubourg <lbedubourg@motion-twin.com>
 * @author   Kornel Lesiński <kornel@aardvarkmedia.co.uk>
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 * @version  SVN: $Id$
 * @link     http://phptal.org/
 */

/**
 * DOM Builder
 *
 * @package PHPTAL
 * @subpackage Dom
 */
abstract class PHPTAL_Dom_DocumentBuilder
{
    protected $_stack;   /* array<PHPTAL_Dom_Node> */
    protected $_current; /* PHPTAL_Dom_Node */

    protected $file, $line;

    public function __construct()
    {
        $this->_stack = array();
    }

    abstract public function getResult();

    abstract public function onDocumentStart();

    abstract public function onDocumentEnd();

    abstract public function onDocType($doctype);

    abstract public function onXmlDecl($decl);

    abstract public function onComment($data);

    abstract public function onCDATASection($data);

    abstract public function onProcessingInstruction($data);

    abstract public function onElementStart($element_qname, array $attributes);

    abstract public function onElementData($data);

    abstract public function onElementClose($qname);

    public function setSource($file, $line)
    {
        $this->file = $file; $this->line = $line;
    }

    abstract public function setEncoding($encoding);
}