...

View Full Version : Multiple DTD's?



CRASH_OVERRIDE
01-07-2003, 02:52 AM
Is it possible to have two DTD for one document? For instance: if I wanted to use the 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' DTD for the structure of my XHTML doc, then use another URL for Entities? Thanks.

Alex Vincent
01-08-2003, 10:09 AM
I have seen this done before. I'm not sure if I remember exactly how. (Note this gets into some truly obscure DTD stuff, so I may need someone to double-check this.)

As I recall, one DTD can reference an entity defined in another document via the <!NOTATION > tag.

<!NOTATION entityName "http://wherever.com/entityDTD">

What that does (if I remember right) is provide a reference to an identically named entity defined in the http://wherever.com/entityDTD file. The entity in the file is defined using the normal <!ENTITY > notation.

So, you'd insert the <!NOTATION > tag(s) in the DOCTYPE tag as an extension of the DTD (which we covered in another thread in this forum, fairly recently, I think).

brothercake
01-08-2003, 01:53 PM
Originally posted by Alex Vincent
So, you'd insert the <!NOTATION > tag(s) in the DOCTYPE tag as an extension of the DTD (which we covered in another thread in this forum, fairly recently, I think).

Yeah it was this thread (http://www.codingforums.com/showthread.php?s=&threadid=11384).

Using that technique could you not just append your entity definitions to the existing DTD, or do you specifically need them to be referenced from an external file?

Alex Vincent
01-08-2003, 08:41 PM
No reason you couldn't, using the <!ENTITY > tags directly inside the <!DOCTYPE > tag. In fact, this is exactly how you would override XHTML 1.1 module definitions. (The inline <!ENTITY > tags load before the DTD file does.)

CRASH_OVERRIDE
01-09-2003, 01:40 PM
So it would be like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [<!ENTITY name "whatever"><!ENTITY name2 "hello">] />

or, would it be wrongful or illegal to just save the XHTML 1.0 Transitional DTD locally and modify it with custom entities?

Alex Vincent
01-10-2003, 09:12 AM
Um, technically there's nothing wrong with modifying the doctype like that. BUT, IE's interpretations of doctypes is spotty at best.

Worse, I'm not sure how Mozilla identifies which type of a document. If it's at least partially by doctype tag, you might be in trouble anyway: Mozilla doesn't really validate by DTD. It might not even read all the entities. (I'm really on uncertain ground here.)

Personally, I'd take the inline version and add in line breaks. Whitespace is cool inside a <!DOCTYPE > tag.

CRASH_OVERRIDE
01-10-2003, 10:10 PM
Thanks, your ideas will help, I'll probably do the inline !entity tags alon with the XHTML transitional DTD.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum