Helle everyone, I am new to XML technologies. I just have simple question, what is the difference between DTD and Schema? Also, could you show me good tutorials from Internet about DTD and Schema as well as how to create them. Thanks for your help, Brian
Author and all-around good cowpoke
Joined: Mar 22, 2000
DTD stands for Document Type Definition - it contains information on how the elements inside the XML document are related to each other. The format of a DTD is not XML unfortunately. A Schema is a way of describing an XML document in greater detail so that not only the relationship of the elements but also their allowed content can be described. Schema documents are valid XML documents which makes it easier for them to be manipulated. The best place to look for authoritative documentation on XML, DTDs and Schema is the W3C http://www.w3.org/ Bill
Hi, In the mock exam XML design questions, there is a question :
Problem : North American Real Estate Associates, a realtor agency would like to convert their inventory listings into XML format. Until now, they used a commercial application to retrive the information from the database and render it to their clients in the HTML format. Apart from being able to supply the inventory information to various different clients (web, handheld, wireless devices etc.), the new XML-based system should also allow numerous real-estate agents across the country to send their local inventory listings to a central application. The new listings and/or update of existing listings will arrive by email as an XML document. A processing application is required to be designed that will analyze the incoming XML documents once everyday and will bring up to date the master database.
Would you say that in such a scenario, using DTD offers more flexibility than using a schema because of less constraints? I think that the same level of constraints that can be achieved by a DTD can be achieved by a Schema simply by omiting those. But is there any other advantage to using DTD that I am not aware of? Thanks, Deb
Leverager of our synergies
Joined: Aug 26, 2000
Originally posted by Debbie Argulkar: Would you say that in such a scenario, using DTD offers more flexibility than using a schema because of less constraints? I think that the same level of constraints that can be achieved by a DTD can be achieved by a Schema simply by omiting those. Deb
I agree. But is there any other advantage to using DTD that I am not aware of? The only one I am aware of is that DTD supports entities and Schema doesn't. But entites do not seem to be crucial part of this application, and their support is a very minor advantage compared to all other things Schema is much better in.
Joined: Jun 08, 2002
The purpose of DTD and Schema is almost same, but the streamline difference is that, using Schemas for making valid documents makes XML language independent. because DTDs are written in Extended Backus-Naur Form, which is not XML ! If we are looking for designing our validity statements in pure XML we should go for XML Based Schemas. However, writing DTDs can be a little easy.
To clear some misconceptions: 1. using Schemas will not make documents valid. Compliance to Schema will. 2. using Schemas will not make XML language independent. XML *is* a language, how can a language be "language independent"? If by XML you mean "specification of its structure", be it DTD or Schema or something else, than preference of one language (XML) over another (EBNF) to express it will not make such a specification language independent either. Accidentally, "XML Certfication" forum is discussing this subject today I posted a quote from David Mertz's "Comparing W3C XML Schemas and Document Type Definitions (DTDs)" there.
Joined: Aug 25, 2002
I would like to add a few points here 1.Schemas offer great support for the data types which DTD does not. 2.In Schemas you can define ur own data type and use them as a new data type. 3.You can define the pattern too.