我的github
posts - 3243,  comments - 42,  views - 158万

XML 模式通常被称为 XML 模式定义(XSD)。它被用来描述和验证 XML 数据的结构和内容。XML 模式定义元素,属性和数据类型。模式元素也支持命名空间。它类似于描述数据库中数据的数据库模式。 XSD(XML模式定义)是互联网联盟推荐的,它规定了可扩展标记语言(XML)文件中的元素的描述方式。

参考:https://baike.baidu.com/item/XML模式定义/17703551?fr=aladdin

示例:

复制代码
<?xml version = "1.0"?>

<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
   targetNamespace = "http://www.yiibai.com" 
   xmlns = "http://www.yiibai.com"
   elementFormDefault = "qualified">

   <xs:element name = 'class'>
      <xs:complexType>
         <xs:sequence>
            <xs:element name = 'student' type = 'StudentType' minOccurs = '0' 
               maxOccurs = 'unbounded' />
         </xs:sequence>
      </xs:complexType>
   </xs:element>

   <xs:complexType name = "StudentType">
      <xs:sequence>
         <xs:element name = "firstname" type = "xs:string"/>
         <xs:element name = "lastname" type = "xs:string"/>
         <xs:element name = "nickname" type = "xs:string"/>
         <xs:element name = "marks" type = "xs:positiveInteger"/>
      </xs:sequence>
      <xs:attribute name = 'rollno' type = 'xs:positiveInteger'/>
   </xs:complexType>

</xs:schema>
复制代码

 

posted on   XiaoNiuFeiTian  阅读(90)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2021-01-29 SQL Server设置默认值
2020-01-29 The 1st Challenge on Remote Physiological Signal Sensing (RePSS) CVPR2020人脸心率估计竞赛
2019-01-29 faceswap安装说明
2019-01-29 jupyterlab notebook区别
2019-01-29 数据分析工具R和RStudio入门介绍
2017-01-29 OpenGL + MFC
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示