Re: DOM Implementation for PHP3
| From: | Stig S. Bakken | Date: | Fri, 16 Apr 1999 08:46:45 +0000 |
| Subject: | Re: DOM Implementation for PHP3 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-5093@lists.php.net to get a copy of this message | ||
Colin Putney wrote:
>
> Hi all,
>
> After a quick scan of the W3C's DOM spec, here are my thoughts on a DOM
> Implementation for PHP. I'm not particularly interested in an OCX-based IDE
> for PHP, so I'll just ignore that thread...
>
> The DOM could be implemented as a library of classes written in PHP. This
> would be a fairly sizable chunk of code and for performance reasons, it
> might be desirable to implement it as pseudo-classes of the kind created by
> the dir() function. (I don't know anything about the magic behind that -
> anyone care to comment?)
>
> There would also have to be an input function for parsing out a HTML/XML
> document and returning a DOM Document object. This would be the root of the
> document tree, which could be manipulated by the script. The modified
> document tree could then be passed to a complementary output function which
> would traverse the tree and return the resulting HTML.
>
> For developers of web-based applications (like myself) this would be an
> elegant way of separating the processing code from the display code. On the
> other hand, I'm not sure that it would be useful enough to make it
> worthwhile. Manipulating the document tree would probably take more code
> than simply generating the raw HTML, and would likely be significant
> overhead.
>
> On the client side, the DOM is really useful as a standard interface for
> DHTML, but on the server side, it seems to be less useful. I may be missing
> something though, because the idea is intriguing. Maybe it would be useful
> as a higher level API to the XML functions.
Something like this has been discussed before, only not in the context
of a DOM implementation. Like Thies said, this could make it much
easier to work with XML documents and it would make the existing XML
extension obsolete.
Apache's mod_dav (http://dav.lyra.org/) has functions to build a tree
from XML data. It would be cool if we could just use that code and map
the structures to PHP. Or we could implement DOM, but that's a lot more
work. :-)
Anyway, I don't think it would be much useful until PHP4 comes out.
Doing this sort of thing with PHP3 is just too painfully slow.
- Stig
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net