File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes DTDs and XML Schemas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DTDs and XML Schemas" Watch "DTDs and XML Schemas" New topic
Author

DTDs and XML Schemas

Arun Subramanian
Ranch Hand

Joined: Oct 30, 2002
Posts: 47
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.


SCJP 1.4, SCBCD 1.3, SCWCD 5.0, SCJD B&S 2.3.1 (in progress)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

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!


Groovy
Arun Subramanian
Ranch Hand

Joined: Oct 30, 2002
Posts: 47
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

Joined: Feb 25, 2004
Posts: 91
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>
Jan Jani
Ranch Hand

Joined: Feb 05, 2004
Posts: 35
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

Joined: Jun 08, 2002
Posts: 3178
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....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Tamer Badr
Ranch Hand

Joined: Feb 18, 2004
Posts: 48
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DTDs and XML Schemas