differences between DTD and Schema

What Are differences between DTD and XML Schema?

The DTD follow SGML syntax but the Schema document is an XML document.

In DTD everything is treated as text where as the Schema supports variety of dataTypes similar to programming language.

In Schema, we can inherit, create relationship among elements but not possible in DTD.

What Is DTD?
The DTD stands for Document Type Definition and used to define the legal building blocks of an XML document.

DTD defines rules for a specific type of document i.e.
1.      Names of elements
2.      Order of elements
3.      Proper nesting and containment of elements
4.      Element attributes

What Is XML Schema Element?
The schema element defines the root element of a schema.

As an Example,
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="values" type="xs:string" />

How To apply a DTD to an XML document?
Include the DTD's element definitions within the XML document itself. Also provide the DTD as a separate file, whose name you reference in the XML document.

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

What Are differences between DTD and XML Schema?  What Are differences between DTD and XML Schema? Reviewed by Anil Singh on 10:48 PM Rating: (5)
www.code-sample.com/. Powered by Blogger.