当前位置:网站首页>验证 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>
边栏推荐
猜你喜欢
Xiaohei's leetcode journey: 117. Fill the next right node pointer of each node II
Kyushu cloud as cloud computing standardization excellent member unit
Chi-square distribution of digital image steganography
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch
ShardingSphere之垂直分库分表实战(五)
ShardingSphere之未分片表配置实战(六)
tkinter模块高级操作(二)—— 界面切换效果、立体阴影字效果及gif动图的实现
VS warning LNK4099: No solution found for PDB
JPEG Steganalysis of Digital Image Steganography
随机推荐
C语言_结构体指针数组函数选票系统
使用PageHelper实现分页查询(详细)
Xiaohei's leetcode journey: 104. The maximum depth of a binary tree
射频器件的基本参数1
typescript15- (specify both parameter and return value types)
I have been working in software testing for 3 years, how did I go from just getting started to automated testing?
BOM系列之Navigator对象
软件测试工作3年了,谈谈我是如何从刚入门进阶到自动化测试的?
Why use high-defense CDN when financial, government and enterprises are attacked?
ROS Action通信
这个项目太有极客范儿了
分布式.分布式锁
kotlin中函数作为参数和函数作为返回值实例练习
Centos 7.9 install PostgreSQL14.4 steps
无线模块的参数介绍和选型要点
Mysql: Invalid default value for TIMESTAMP
DOM系列之 client 系列
Rocky/GNU之Zabbix部署(2)
Solution: Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
Parameter introduction and selection points of wireless module