Proposal: DOM package

From: Date: Tue, 08 Jul 2003 15:07:44 +0000
Subject: Proposal: DOM package
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18090@lists.php.net to get a copy of this message
Hi, This is a set of classes implementing the DOM Level 2 Specification to provide an abstraction layer for the various versions of PHP4's domxml extension and PHP5's dom extension. The main goal in writing this was to avoid recoding all xml stuff everything when PHP5 becomes available. A side effect is that it makes domxml much more DOM-compliant (which can't be a bad thing ;) An example usage would look something like: 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"; Each of the DOM 'interfaces' is represented as a class - which means that the package will also bring some previously unavailable functionality, such as NamedNodeMaps and DocumentFragments, to domxml. There's also a test suite which currently runs nearly 200 tests over the classes, checking return values for conformance to the DOM level specified. I've thrown up more details, source code and test results at: http://matt.online-canarias.com/dom/ The bad news is it's not done yet - it's still buggy and I haven't even started work on the PHP5 side of things. I'm posting this to get some feedback and see if there's enough interest to do the work to make this into a proper PEAR package. Plus ask a few questions:) What should the package be called? I think just DOM - that'd follow PHP5's extension name and is nice and unambiguous. But does it belong under XML or out on its own? Anyone got any experience with the ins and outs of overloading? It'd be great to avoid the 'methodization' of attributes ($node->nodeValue() instead of $node->nodeValue), but I can't seem to get it to work on extended classes. Anyone know where I can find a single xml document that includes absolutely everything in DOM2 for testing on? The classes could also be used as a basis for a PHP-only DOM implementation (ie not using an extension or only using SAX for loading docs) a la XML_Tree, but with real DOM compliance. That'd be a lot of work and prob. slow as sin on any large document, but it'd be good for people without the extension installed. Anyone interested in helping? Regards, Matt

« previous php.pear.dev (#18090) next »