DOM Abstraction Classes for PHP

Matt Kynaston [1] proposed a package to PEAR that handles DOM with PHP 4.3.x like the upcoming PHP5.

require_once(\”DOM_Document.php\”);
$dom =& DOM_Document::factory(\’domxml\’);
$dom->load(\’tests/article.001.xml\’);

$node =& $dom->createTextNode(\”Hello World!\”);
$root =& $dom->documentElement();
$root->appendChild($node);

$xmlstr = $dom->saveXML();

echo \”xml: $xmlstr\”;

Why should this be of any use? Since one can work with an abstraction of DOM it will be much easier to upgrade the written applications from PHP4 to PHP5.

Update:
The installation should work like:

pear install http://matt.online-canarias.com/dom/DOM.tar.gz

[1] http://matt.online-canarias.com/dom/

Leave a Reply