1--TEST--
2Test: registerNodeClass()
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7class myAttribute extends DOMAttr {
8   function testit() { return "HELLO Attribute"; }
9}
10
11class myElement extends DOMElement {
12   function testit() { return "HELLO Element"; }
13}
14
15$doc = new DOMDocument();
16$doc->registerNodeClass('DOMAttr', 'myAttribute');
17$doc->registerNodeClass('DOMElement', 'myElement');
18$doc->appendChild(new DOMElement('root'));
19$root = $doc->documentElement;
20$root->setAttribute('a', 'a1');
21echo get_class($root), "\n";
22print $root->testit()."\n";
23$attr = $root->getAttributeNode('a');
24echo get_class($attr), "\n";
25print $attr->testit()."\n";
26unset($attr);
27$doc->registerNodeClass('DOMAttr', NULL);
28$attr = $root->getAttributeNode('a');
29echo get_class($attr), "\n";
30try {
31    print $attr->testit()."\n";
32} catch (Error $e) {
33    echo $e->getMessage();
34}
35?>
36--EXPECT--
37myElement
38HELLO Element
39myAttribute
40HELLO Attribute
41DOMAttr
42Call to undefined method DOMAttr::testit()
43