当前位置:网站首页>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>
边栏推荐
猜你喜欢
随机推荐
After reading "MySQL Database Advanced Practice" (SQL Xiao Xuzhu)
MySQL的安装教程(嗷嗷详细,包教包会~)
Force buckled brush the stairs (7/30)
Drools Rule Properties, Advanced Syntax
Jiuzhou Cloud was selected into the "Trusted Cloud's Latest Evaluation System and the List of Enterprises Passing the Evaluation in 2022"
关于Redis相关内容的基础学习
mysql index
Tower of Hanoi problem
Crawler text data cleaning
pycharm cannot run after renaming (error: can't open file...No such file or directory)
基于FPGA的售货机
leetcode-952:按公因数计算最大组件大小
简易表白小页面
link与@import的区别
程序员转正述职报告/总结
What does a software test report contain?
软件测试报告有哪些内容?
真正的CTO,是一个懂产品的技术人
12张图带你彻底搞懂服务限流、熔断、降级、雪崩
leetcode-128:最长连续序列