Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XMLSchema and DTD

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I understand XMLSchema's adv over DTD, but what i can't figure out is, when should we go for XMLSchema and when should we go for DTD ?
Can some throw a light on this ?
Thanks in advance
Hari
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say that XML Schema have numerous advantages over DTD which may be found in many resources. moreover, a XML Schema may be handled as a normal XML file whereas DTD cannot. Since now JAXP 1.2 provides validation using XML Schema using the code below, I would prefer going for XML Schema than for DTD.
To set up a parser for validation using XML schema, include the following statements:
saxBuilder.setValidation(true);
saxBuilder.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Mertz, Ph.D. "Comparing W3C XML Schemas and Document Type Definitions (DTDs)":
"DTDs are still your best choice when:
  • A compact representation of your document rules is important to you.
  • You want downstream users to be able to override and specialize types via parametric internal sets.
  • Your document rules primarily concern nesting of elements, not semantic constraints on contents (as in prose markup).
  • The tools you are used to using support DTD better than schemas. "


  • I assume in all other cases Schema should be preferred.
    [ August 16, 2002: Message edited by: Mapraputa Is ]
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic