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" />
</xs:schema>

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

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 Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^