• 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 schema and dtd

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was asked this in an interview today: What is the difference between a dtd and a schema in XML? Guess he got me on that one. Anyone know the answer?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope these links help:

http://www.irt.org/script/1487.htm
http://www.webheadstart.org/html/wwwlist/2003Jan/mail_9110.htm
 
M Burke
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sort of. Do you have an example of how to use a schema in a document?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do people stil use DTDs? Here is a standard reference of XML Schemas: http://www.w3.org/TR/xmlschema-0/
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XML is extensible.

For example,
<PERSON><NAME>JESUS</NAME></PERSON>

Therefore, there may come a need to make it strict, like in business to business communication using XML as their language.

DTD is an old way of stating rules on the contents of an XML instance.

For example, in informal way, you can create a DTD that says that the PERSON tag must have exactly 2 NAME entries. So the xml instance above will fail XML checking(called parsing/validation), because it only have 1 NAME tag. This one will pass validation:

<PERSON><NAME>JESUS</NAME><NAME>ANGELES</NAME></PERSON>

SCHEMA is a newer, more powerful way of stating rules on the contents of an XML instance.

For example, same thing, as the sample in DTD above.

DTD and SCHEMA are different. DTD is written in its own language. SCHEMA is written in XML form.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic