1<?php
2
3class PHP4DOMTree {
4  var $_element;
5
6  function PHP4DOMTree($domelement) {
7    $this->_element = $domelement;
8    $this->content = $domelement->get_content();
9  }
10
11  function &document_element() {
12    $element = $this->_element->document_element();
13    return $element;
14  }
15
16  function &first_child() {
17    $child =& PHP4DOMTree::from_DOMDocument($this->_element->first_child());
18    return $child;
19  }
20
21  function &from_DOMDocument($domdocument) {
22    if (!$domdocument) {
23      $null = null;
24      return $null;
25    };
26
27    $tree =& new PHP4DOMTree($domdocument);
28    return $tree;
29  }
30
31  function get_attribute($name) {
32    return $this->_element->get_attribute($name);
33  }
34
35  function get_content() {
36    return $this->_element->get_content();
37  }
38
39  function has_attribute($name) {
40    return $this->_element->has_attribute($name);
41  }
42
43  function &last_child() {
44    $child =& PHP4DOMTree::from_DOMDocument($this->_element->last_child());
45    return $child;
46  }
47
48  function &next_sibling() {
49    $sibling =& PHP4DOMTree::from_DOMDocument($this->_element->next_sibling());
50    return $sibling;
51  }
52
53  function node_type() {
54    return $this->_element->node_type();
55  }
56
57  function &parent() {
58    $parent =& PHP4DOMTree::from_DOMDocument($this->_element->parent());
59    return $parent;
60  }
61
62  function &previous_sibling() {
63    $sibling =& PHP4DOMTree::from_DOMDocument($this->_element->previous_sibling());
64    return $sibling;
65  }
66
67  function tagname() {
68    return $this->_element->tagname();
69  }
70}
71?>