• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML DTD vs Schema

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, here is an old post for the same topic.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic