当前位置:网站首页>验证 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>
边栏推荐
猜你喜欢
1782. Count the number of point pairs Double pointer
【952. Calculate the maximum component size according to the common factor】
typescript9-常用基础类型
ShardingSphere's public table combat (7)
使用docker安装mysql
Yolov7实战,实现网页端的实时目标检测
The sword refers to offer17---print the n digits from 1 to the largest
JPEG Steganalysis of Digital Image Steganography
小黑leetcode之旅:117. 填充每个节点的下一个右侧节点指针 II
Responsive layout vs px/em/rem
随机推荐
typescript11 - data types
调度中心xxl-Job
孩子的编程启蒙好伙伴,自己动手打造小世界,长毛象教育AI百变编程积木套件上手
仿牛客网项目总结
认识DTU什么是4GDTU设备
Teach you how to configure Jenkins automated email notifications
TiDB之rawkv升级之路v5.0.4--&gt;v6.1.0
"Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis
使用docker安装mysql
typescript9 - common base types
Artificial Intelligence and Cloud Security
typescript13 - type aliases
1782. Count the number of point pairs Double pointer
解决:Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
In Google Cloud API gateway APISIX T2A and T2D performance test
小黑leetcode之旅:104. 二叉树的最大深度
TiCDC 架构和数据同步链路解析
设置浏览器滚动条样式
Word 表格跨页,仍然显示标题
297. 二叉树的序列化与反序列化