当前位置:网站首页>验证 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>
边栏推荐
- Typescript14 - (type) of the specified parameters and return values alone
- typescript11-数据类型
- 射频器件的基本参数1
- VS warning LNK4099: No solution found for PDB
- tensorflow与GPU版本对应安装问题
- 剑指offer17---打印从1到最大的n位数
- 小黑leetcode之旅:104. 二叉树的最大深度
- Know what DTU is 4GDTU equipment
- typescript15- (specify both parameter and return value types)
- Jetpack Compose learning (8) - State and remeber
猜你喜欢
随机推荐
typescript14-(单独指定参数和返回值的类型)
typescript9-常用基础类型
35. 反转链表
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
DOM系列之 offset 系列
Centos 7.9安装PostgreSQL14.4步骤
typescript13-类型别名
Rocky/GNU之Zabbix部署(2)
解决:Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
C language _ structure pointer array function voting system
TiDB 在长银五八消费金融核心系统适配经验分享
Multiplication, DFS order
typescript10-常用基础类型
ShardingSphere之读写分离(八)
ROS Action通信
typescript16-void
认识DTU什么是4GDTU设备
typescript13 - type aliases
DOM系列之动画函数封装
权限管理怎么做的?









