• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTDs and XML Schemas

 
Arun Subramanian
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elliotte-
A big welcome to you for having joined us in the forum
Are XML Schemas thought of as a replacement for DTDs or are they just supplements? Do they have distinct usages (though my understanding is that both are used for validating XML documents). Just an observation that even though the schema language is more rigorous, common XML documents that we deal with, like web.xml, still follow DTD validation.

Thanks,
Arun.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope that you dont mind if I answer your question.
I believe that XML schemas are going to replace DTD. Newer application are mostly likely to use schemas for validating because of its advanced features whereas application which are using DTD will continue with them.
Consider J2EE 1.4, deployment descriptors are based on XML schema. J2EE 1.3 was based on DTDs.
.Thanks!
 
Arun Subramanian
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep-
Thanks for enlightening me that J2EE 1.4 makes use of XML schemas. And yes, I was able to get the answers for my questions.
 
Elliotte Rusty Harold
author
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Schemas are not a replacement for DTDs. DTDs are well supported, well understood, and will be with us for a long time to come. They are more appropriate than schemas for many types of documents including narrative documents like web pages and books. See Item 24, Choose the right schema language for the job, for more on this topic.
 
Jan Jani
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Schemas are not the replacement of DTD,but DTDs have limited scope and Schemas have no limitations you can enjoy complete OOP while writing a Schema
~JANI
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Consider J2EE 1.4, deployment descriptors are based on XML schema. J2EE 1.3 was based on DTDs.

Addition to that, I would like to mention that the elements in deployment descriptors of J2EE 1.3 must care about the order of the elements, while in J2EE 1.4, the order is not important at all... Simply it is because J2EE 1.4 applied XMl Schema, instead of DTDs....
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ko Ko Naing:
Addition to that, I would like to mention that the elements in deployment descriptors of J2EE 1.3 must care about the order of the elements, while in J2EE 1.4, the order is not important at all... Simply it is because J2EE 1.4 applied XMl Schema, instead of DTDs....
Yes, although you can enforce element order with XML Schema as well.
 
Tamer Badr
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML Schema is an XML based alternative to DTD.
An XML schema describes the structure of an XML document.
The XML Schema language is also referred to as XML Schema Definition (XSD).
The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD.
An XML Schema:
defines elements that can appear in a document
defines attributes that can appear in a document
defines which elements are child elements
defines the order of child elements
defines the number of child elements
defines whether an element is empty or can include text
defines data types for elements and attributes
defines default and fixed values for elements and attribute
Very soon XML Schemas will be used in most Web applications as a replacement for DTDs. Here are some reasons:
XML Schemas are extensible to future additions
XML Schemas are richer and more useful than DTDs
XML Schemas are written in XML
XML Schemas support data types
XML Schemas support namespaces
XML Schema was originally proposed by Microsoft, but became an official W3C recommendation in May 2001.
The specification is now stable and has been reviewed by the W3C Membership.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic