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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cant understand the role of DTDs

    Hi
    I am a complete newbie to XML. I just finished the DTD part. At first, I thought that going against a specified DTD in an XML document would give an error (like providing an element in an XML document which is not in the DTD or providing a value for an attribute in the XML markup other than the possible values specified in the DTD). But then some1 told me that it wont. And now I'm all confused. Why are DTDs there if someone can just give well-formed markup and go against the DTDs and get his XML markup to work just fine.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Think of it like this:

    You have well-formedness, and you have validity. If you are well-formed, any XML parser can read the document. If you are valid (via DTD, Schema, RelaxNG, whatever), then application-specific parsers can read the document.

    You can get away with invalid XHTML in, say Firefox, because Firefox uses a non-validating parser. If you break the DTD, its error handling will take care of it. MSXML, however, is validating (though not terribly great at it). Try using an XHTML 1.1 doctype in IE with a page sent as XML -- it will throw a DTD error and not even render the document tree. So, whomever told you being invalid didn't matter only told you a partial truth.

  • #3
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks u cleared my doubts


  •  

    Posting Permissions

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