当前位置:网站首页>验证 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>
边栏推荐
猜你喜欢
随机推荐
Analyze the capabilities and scenarios of the cloud native message flow system Apache Pulsar
认识DTU什么是4GDTU设备
这个项目太有极客范儿了
Teach you how to configure Jenkins automated email notifications
分布式.幂等性
822. Walk the Grid
斩获BAT、TMD技术专家Offer,我都经历了什么?
typescript10-commonly used basic types
【genius_platform软件平台开发】第七十四讲:window环境下的静态库和动态库的一些使用方法(VC环境)
The level of ShardingSphere depots in actual combat (4)
设置浏览器滚动条样式
MySQL (6)
Word 表格跨页,仍然显示标题
Installation problem corresponding to tensorflow and GPU version
822. 走方格
.NET 跨平台应用开发动手教程 |用 Uno Platform 构建一个 Kanban-style Todo App
响应式布局与px/em/rem的比对
I have been working in software testing for 3 years, how did I go from just getting started to automated testing?
typescript12 - union types
ShardingSphere's vertical sub-database sub-table actual combat (5)









