• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

XMLSchema and DTD

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
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
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 ]
     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic