This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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!
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.
Elliotte Rusty Harold<br />Author of <a href="http://cafe.elharo.com/web/refactoring-html/" target="_blank" rel="nofollow">Refactoring HTML</a>
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....
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.
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.