alvinphp wrote:The Ninja Space Goat wrote:Umm... yea pretty much. Do you use that at all? I haven't had time to look it over completely, but I imagine this could be used to compose fully valid XHTML documents? This could be a pretty powerful set of objects if put in the right hands it seems like... I wonder how come I've never seen/heard of it before...

Why not just code the site in XHTML? I am kind of confused at the point of this. All the sites I do now are in XHTML.
XML or more specifically SGML is the markup language. It defines what a tag is, but not how it is structured, etc...
HTML, XHTML, XML, VML, etc are all forms of SGML...just specialized.
HTML has a structure, but it's loosely enforced whereas XHTML strict requires very specific structure and tagging rules, like closing all tags, etc...
You can use a DOM to interact with *any* SGML document, regardless of whether it's an XML file or XHTML strict...
Not everyone knows how to write 100% valid XHTML...myself included although I've done pretty go so far
You could read a template which was poorly written in HTML 3 or 4 by an end user who used Front Page, etc load it into a DOM and programatically make the HTML code XHTML STRICT but it would take alot of work...
Likewise, by abstracting the SGML model in the form of a DOM (which is what I assume Spacegoat meant?) you could easily incorporate drivers to output specific document types according to browser detection, etc...
For instance, your PHP script could detect if the user had the latest browser and output valid XHTML code...but if there using an older browser maybe HTML 4 would suffice or even be better off...
The idea or principle is solid, I only disuade because it's a helluva lof of work...
When re-writting HTML to XHTML or visa-versa...you *may* likely have to change the DOM and when it's output to whatever format, this may result in visually malformed pages, despite being technically correct...
I can't think of a concrete example, but consider the following:
The users WYSIWYG editor outputs something like:
<span><h3>Hello <i>italicized</h3> world</i></span>
Horrible HTML I agree and not likely done by any WYSIWYG, but...it's possible, perhaps by hand written inexperienced developers???
How do you correct that code to XHTML programatically???
Does the author intend:
<h3><span>Hello </span><i>italicized world</i></h3>
or
<h3><span>Hello </span> italicized</h3><i>world</i>
Not to mention all the rules behind writing valid XHTML code...
Horrible example, but I think it illustrates my point...
There is alot of work to be done, which is "almost" impossible without first rendering the pre & post HTML to compare changes and test to see if visually they are different or not...
Basically...the way I see it...it's a major PITA to develop something quite like that...
But again i'm not sure where Spacegoat is planning on taking this...perhaps it's not quite what I think it is???
Cheers
