Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Multiple DTD's?

  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    IN, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple DTD's?

    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.
    Just call me Crash...
    "Crash- and BURN!"
    -Cereal Killer

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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).
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    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?

  • #4
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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.)
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    IN, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    Just call me Crash...
    "Crash- and BURN!"
    -Cereal Killer

  • #6
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    IN, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, your ideas will help, I'll probably do the inline !entity tags alon with the XHTML transitional DTD.
    Just call me Crash...
    "Crash- and BURN!"
    -Cereal Killer


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •