当前位置:网站首页>Validate XML documents
Validate XML documents
2022-07-31 01:52: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>
边栏推荐
猜你喜欢

Basic introduction to ShardingJDBC

Interprocess communication study notes

12张图带你彻底搞懂服务限流、熔断、降级、雪崩

Shell script to loop through values in log file to sum and calculate average, max and min

Introduction and use of Drools WorkBench

pycharm cannot run after renaming (error: can't open file...No such file or directory)

华为od 转骰子 js

rpm安装postgresql12

Drools basic introduction, introductory case, basic syntax

Force buckled brush the stairs (7/30)
随机推荐
Multiplication, DFS order
What are the project management tools like MS Project
项目开发软件目录结构规范
"Cloud native's master, master and vulgar skills" - 2022 National New College Entrance Examination Volume I Composition
基于FPGA的售货机
【微信小程序】一文带你了解数据绑定、事件绑定以及事件传参、数据同步
leetcode-128: longest continuous sequence
软件测试报告有哪些内容?
一个无经验的大学毕业生,可以转行做软件测试吗?我的真实案例
leetcode-399:除法求值
[1154] How to convert string to datetime
手把手教你配置Jenkins自动化邮件通知
Software testing basic interface testing - getting started with Jmeter, you should pay attention to these things
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
最高月薪20K?平均薪资近万...在华为子公司工作是什么体验?
pc端判断当前使用浏览器类型
leetcode-399: division evaluation
[1154]如何将字符串转换为datetime
rpm安装postgresql12
12 pictures take you to fully understand service current limit, circuit breaker, downgrade, and avalanche