当前位置:网站首页>验证 XML 文档
验证 XML 文档
2022-07-31 01:21:00 【ahyo】
合法的 XML 文档是"形式良好"的 XML 文档,这也符合文档类型定义(DTD)的规则:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE note SYSTEM "Note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
在上面的实例中,DOCTYPE 声明是对外部 DTD 文件的引用。下面的段落展示了这个文件的内容。
XML DTD
DTD 的目的是定义 XML 文档的结构。它使用一系列合法的元素来定义文档结构:
<!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]>
W3C 支持一种基于 XML 的 DTD 代替者,它名为 XML Schema:
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
边栏推荐
- BOM系列之Navigator对象
- Why use high-defense CDN when financial, government and enterprises are attacked?
- 数字图像隐写术之JPEG 隐写分析
- The Meta Metaverse Division lost 2.8 billion in the second quarter, still want to continue to bet?Metaverse development has yet to see a way out
- 仿牛客网项目总结
- 822. Walk the Grid
- 关于Redis相关内容的基础学习
- 倍增、DFS序
- Unity2D horizontal version game tutorial 4 - item collection and physical materials
- Kyushu cloud as cloud computing standardization excellent member unit
猜你喜欢
随机推荐
认识DTU什么是4GDTU设备
typescript13 - type aliases
In Google Cloud API gateway APISIX T2A and T2D performance test
《实战》基于电商领域的词性提取及其决策树模型建模
TypeScript在使用中出现的问题记录
typescript10-常用基础类型
Typescript18 - object type
87. Convert String to Integer
87. 把字符串转换成整数
Yolov7实战,实现网页端的实时目标检测
The sword refers to offer17---print the n digits from 1 to the largest
C language _ structure pointer array function voting system
prometheus 监控概述
ShardingSphere read-write separation (8)
tensorflow与GPU版本对应安装问题
1782. Count the number of point pairs Double pointer
"Actual Combat" based on part-of-speech extraction in the field of e-commerce and its decision tree model modeling
JPEG Steganalysis of Digital Image Steganography
Dispatch Center xxl-Job
Image processing tool design








