Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sample analysis of XML document type declaration

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the example analysis of XML document type declaration, which is very detailed and has certain reference value. Friends who are interested must finish it!

Because XML can customize tags, everyone defines a different set of tags, and applications cannot process XML documents without a set of standards that define the principles for defining tags. The solution to this problem is DTD,DTD (Document Type Definition, document type definition), which is used to define the writing rules of XML documents. Such as which elements can appear in the document, and the requirements of the content and attributes of the element, and so on. The application will use this DTD to verify the document, and the XML document that conforms to the DTD constraint rules is called a valid document, which can be processed in the next step, otherwise an error will be reported, and the application can catch the error for corresponding exception handling. The inspection process is optional, depending on the specific application.

Document type declaration

To use DTD for validation, specify the DTD using the document type definition declaration. Such as:

The Jims Jims@163.com Jims@21cn.com document type declaration is after the XML declaration and before the root element. If the dtd document is native, the path name can be used to directly indicate the location of the dtd document. The portal.dtd is as follows:

The above content can also be written directly to the XML document. This dtd declaration method is called internal dtd subset, such as:

] > Jims Jims@163.com Jims@21cn.com if the dtd is outside the XML document, it is called an external dtd subset. We can combine internal and external dtd to form a dtd to validate XML documents. Such as:

] > Note: when using internal and external dtd, the two dtd should be compatible with each other and there should be no conflicts.

The above is all the contents of the article "sample Analysis of XML document Type declarations". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report