DTD

The role of DTD

An XML document is a meta markup language, a language that defines a markup language. New markup languages ​​can be created in XML, and these new markup languages ​​are defined by document type definitions. DTD documents are the legal documents for these new markup languages. If the syntax of the XML document conforms to the definition and specification of DTD, it is called a legal XML document, otherwise it is an illegal XML document. The status of legal XML documents in practical applications is very important. Because only legal XML documents can be effectively processed by application software.

DTD defines the logical structure of the document and specifies the elements, entities, attributes of elements, and the relationship between elements and entities used in the document. Its role is mainly manifested in the following aspects:

1 Using DTD can provide a unified format. The extensibility of XML provides a high degree of flexibility for document authors, but sometimes uniformity is required, requiring a certain type of document to have the same structure.

2 The use of DTD can ensure the smooth progress of data exchange and sharing.

3DTD enables users to know the logical structure of a document without relying on specific data. When there is no XML document, you can also write a style sheet and a processing program for the XML document according to the DTD, which can effectively improve the work efficiency.

4 The validity of the data can be verified using the DTD. DTD constrains the logical structure of the document, which can be loose or very strict. Data can be checked against the DTD to verify compliance with regulations and requirements, which guarantees that the data is correct and valid.

DTD element

The basic components described in a DTD are elements and attributes, which are responsible for determining the logical structure of an XML document. Elements represent an information object, and attributes represent properties of this object. All elements have one and only one root element, and all other elements are his child elements. Is every element contained by other elements except the root element, an element can have several different types of child elements.

basic type of element

The basic types of elements can be roughly divided into two types: one is called simple type and the other is called composite type. The simple type has text data, i.e. parsed character data, this type also becomes "#PCDATA" in the context; the compound type can contain other elements and text data.

1 Simple

"#PCDATA" indicates that the marked content is parsable text, and the so-called parsable text is non-marked text. An element canonicalized with "#PCDATA" can no longer contain text, and how do you<list>do<list> is not a parsable data type because it contains the tags <list> and <list>. In addition, the order of definitions of different elements in a DTD document is not related, but the syntax of the document is case-sensitive.

The declaration format of "#PCDATA":

<!ELEMENT Element_Name (#PCDATA)>

Summarize:

I feel that copying and learning is too slow.

Attach a quote

The whole point of our life is to create, and struggle is a means.


G
M
T
Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
Text-to-speech function is limited to 200 characters

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325781290&siteId=291194637
DTD