Difference between Schema and DTD

Source: Internet
Author: User

Schema is the definition and description of the structure of an XML document. It is mainly used to constrain the XML file and verify the validity of the XML file. The role of DTD is to define the legal construction module of XML. It uses a series of legal elements to define the document structure. The differences between them are as follows:

1. schema itself is also an XML document. The DTD definition has nothing to do with XML. schema has many advantages in understanding and practical application.

2. The structure of the DTD document is "tiled". If a complex XML document is defined, it is difficult to grasp the nested relationship between each element. The schema document has a strong structure, the nested relationship between elements is very intuitive.

3. The DTD can only specify that the element contains text, but cannot define the specific type of the element text, such as struct type, integer type, date type, and custom type. Schema is more powerful than DTD in this respect.

4. The schema supports the description of the order of element nodes. The DTD does not provide a description of unordered conditions. To define unordered conditions, all conditions that must be in an exhaustive arrangement must be defined. Schema can use Xs: all to indicate disorder.

5. namespace support. The DTD cannot use the namespace of XML, and the schema satisfies the namespace well. In addition, schema also provides two methods to reference namespaces: Include and import.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.