Organizing HTML's elements

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Organizing HTML's elements

Post by Ambush Commander »

A little context: HTML is made up of elements: a, b, u, blockquote, div, etc. In XHTML 1.1, these elements are arranged into modules: Text, Hypertext, Lists, etc.

The XHTML 1.1 modularization of HTML is great. It makes it extremely simple to mix and match functionality based on your needs: use basic text elements and not tables or lists. Use tables and lists, but no forms or inline scripting. But sometimes, a user wants to just be able to say: "I want p, b, i and a allowed." Then you run into problems.

XHTML 1.1 is not designed to allow this sort of granularity in picking which tags you want to allow. To get the desired effect, you'd have to roll a custom XML Schema or DTD with the elements you want: not the most pleasant task. So, I want to work around this limitation: let the user mix and match elements and modules to get what they want: p, b, i and the Hypertext module.

But where does the software get the p tag from? The Text module, of course, but how does it know that? As of right now, I've solved this problem by loading every module possible for a particular doctype and then registering it to an element lookup array. Element to module, a many to one relationship.

Well, not really. Here's the tricky part: XHTML Modularization allows for the redefinition of elements. So your blockquote tag might actually be influenced by the Text module AND the Legacy module. Furthermore, modules may have global effects: the Bi-directional text module, in addition to defining the bdo tag, registers the dir attribute to all elements.

At this point, I am totally at loss to what a good structure for organizing these internals should be. Any thoughts?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Is this for the doctype setting function? ??

I think we have a man overboard.... someone throw him a doughnut!!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Not really, but they are from the same library. The doctype setting function is just part of the API the developers will use. This about the internals.

I'd appreciate a donut very much! Some ideas on this problem would be good too though.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

It sounds to me like it's more work to generate a DTD with code than it would be by hand - what is the advantage / target use exactly?

I'll PM you a doughnut ;-) (me and my colourful Canadian spelling)
Post Reply