PDA

View Full Version : My own DTD for XHTML?


beetle
12-12-2002, 03:48 PM
Hey folks. I've got a page that uses ONE extra attribute for LI elements, and I'd like it to validate (it's the ONLY error on my page (http://www.peterbailey.net/nm/)). I downloaded the XHTML1 DTD from the W3C and added this<!ELEMENT li %Flow;>
<!ATTLIST li
%attrs;
ignore CDATA #IMPLIED
>Then saved the DTD and pointed my DOCTYPE at this DTD. However, the page still doesn't validate. Did I do this incorrectly? Or can this not be done?

Alex Vincent
12-12-2002, 11:54 PM
Did you save the DTD locally or to a website? Remember, the W3C Validator can't really read your hard drive.

beetle
12-13-2002, 04:35 AM
C'mon d00d, gimme a bit more credit than that! :D You could have at least checked the source for yourself....I provided a link :p

http://www.peterbailey.net/nm/nm.dtd

Alex Vincent
12-14-2002, 12:35 AM
Try this DOCTYPE tag:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
<!ATTLIST li
ignore CDATA #IMPLIED
>
]>


Your DTD was correctly written, I believe.

brothercake
12-14-2002, 12:41 AM
Hey wow - can you really just add to an exisiting DTD ...? that's way cool :)

Alex Vincent
12-14-2002, 12:57 AM
Sure you can, XML 1.0 specification.

Moderators gotta know something about what their forum discusses. ;)

jkd
12-14-2002, 01:49 AM
Originally posted by Alex Vincent
Moderators gotta know something about what their forum discusses. ;)

They sure gotta know something :p ;).

beetle
12-14-2002, 05:13 AM
Thanks Alex, it validates perfectly, but...

Tha last ]> shows up on my page as text. Some tiny syntactical oversight perhaps? Or just stoopid IE? I tried a couple variations but either the text kept showing up, or the page didn't validate. Thanks for the help!

krycek
12-14-2002, 10:28 AM
Hi beetle, I don't want to interrupt your thread (well I already have so tough! :D) but it seems like an ideal place to post the following questions:

1. Could someone who knows post an example of how to extend the DTD with any property? Just quickly? I mean, it appears to me that there are two main extensions that can be done (excluding events) - adding a new tag, such as <mytag>, and adding an attribute <div myattr>. It would be nice to have a simple guideline on how to do this so that it would be syntatically correct, and also work ok :)

2. Events - is it possible to simply add an event to the defined events list? Like, how would that work? :confused: I mean, if you added your own event and then captured it, how would it ever be triggered? How would the browser know when to trigger it? Or is this just not possible.

It would also be nice to know what browser support there is for the above :)

I know that beetle has covered part of that but his request is quite specific, mine is more general as I have the same problem as beetle atm but in a different way. It may also be an idea to make this thread sticky once answered, because I could not find this info elsewhere in the forum (I guess beetle couldn't either) ;)

Cheers people!

::] krycek [::

jkd
12-14-2002, 05:02 PM
Originally posted by krycek
2. Events - is it possible to simply add an event to the defined events list? Like, how would that work? :confused: I mean, if you added your own event and then captured it, how would it ever be triggered? How would the browser know when to trigger it? Or is this just not possible.

In Mozilla, you can fire any event you want, even custom events via:

var evt = document.createEvent('Events');
evt.initEvent('mycustomEvent', false, false);
someEventTarget.dispatchEvent(evt);

IE only allows the firing of custom events on scriptlets, which makes it pretty much worthless.

krycek
12-14-2002, 05:08 PM
but surely those 'custom' events can only be chosen from a bigger list of pre-defined events? Coz let's say you wanted to make a new event, called, say, onReachLeft which will fire whenever an animated object reaches the left side of the screen, how would you attach this? So that the event fires, I mean? I don't get that bit :confused:

::] krycek [::

jkd
12-14-2002, 05:51 PM
Through some crafty scripting.

See here for an example on Moz:
http://www.webfx.eae.net/dhtml/xblmarquee/xblmarquee.html

krycek
12-14-2002, 06:34 PM
that is a very, very cool link! :D

do you think IE will ever support this XBL stuff etc. etc.

::] krycek [::

jkd
12-14-2002, 06:39 PM
Originally posted by krycek
do you think IE will ever support this XBL stuff etc. etc.

IE supports Element and ViewLink behaviors. Not quite as powerful as XBL, but it also doesn't suffer from the same, near-crippling global namespace issue Javascript has in XBL.

Behaviors are a little easier, but I find XBL to be cleaner. I used to have examples of widgets I wrote using "custom tags" and behaviors/xbl to make then do stuff. Not sure if I still do, but I once had a:
<rdhtml:window/> widget which created a draggable DOM window that could be added by simple markup instead of Javascript that polluted the global namespace of the webpage (pure encapsubility)

krycek
12-14-2002, 07:01 PM
so it would be possible to do this x-browser? I mean, make an encapsulated custom element, using both methods, one for each browser? that would be very cool... do you have any links to articles about doing this x-browser, or are you willing to share any of the code you have? (Just how to construct the element etc.)

it sounds very very interesting!

::] krycek [::

beetle
01-02-2003, 07:25 PM
Originally posted by beetle
Thanks Alex, it validates perfectly, but...

Tha last ]> shows up on my page as text. Some tiny syntactical oversight perhaps? Or just stoopid IE? I tried a couple variations but either the text kept showing up, or the page didn't validate. Thanks for the help! I'd still like to know the answer to this

Anyone? :confused:

jkd
01-02-2003, 08:16 PM
Originally posted by beetle
I'd still like to know the answer to this

Anyone? :confused:

I'm guessing that you're serving the page as text/html? Don't expect IE to do anything correctly in that case.

liorean
11-19-2003, 01:31 AM
Ie is neither a full-fledged SGML nor a full-fledged XML processor. It doesn't know the syntactical rules that exist for notations or internal DTDs, it knows only an HTML approximation. Thus, it asumes that the out commented tag (which is how it percieves notation nodes) that started with "DOCTYPE html" contains a lot of bad formed html. Since you are not starting a comment node, however, it will not ignore the tag end within the brackets, and thus end the tag there. What appears without gets rendered.

brothercake
11-19-2003, 02:09 AM
You could always make it invisible with the same color/background on HTML and BODY:

html,body { color:#fff; background-color:#fff; }

Then use another containing element to get the page colors you really want.

Or you could just cover it up with an absolutely-positioned element.