.net下的schema语法

<xs:schema id="Question_Attributes_Schema"
                  targetNamespace="http://tempuri.org/Question_Attributes_Schema.xsd"
                  elementFormDefault="qualified"
                  xmlns="http://tempuri.org/Question_Attributes_Schema.xsd"
                  xmlns:mstns="http://tempuri.org/Question_Attributes_Schema.xsd"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--问题属性-->
<xs:element name="问题属性">
 <xs:complexType>
  <xs:sequence>
   <!--问题基本属性-->
   <xs:element name="问题基本属性"  type="Basic_Question"/>
   <!--问题扩展属性-->
   <xs:element name="问题扩展属性"  type="Extend_Question"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

<!--自定义"问题基本属性"类别-->
<xs:complexType name="Basic_Question">
  <xs:attribute name="id"    type="xs:integer"/>
  <xs:sequence>
   <xs:element name="问题标题"   type="Question_Basic_Attribute"/>
   <xs:element name="问题描述"   type="Question_Basic_Attribute"/>
   <xs:element name="问题类型"   type="Question_Basic_Attribute"/>
   <xs:element name="问题添加时间"  type="Question_Basic_Attribute"/>
   <xs:element name="问题编写者"  type="Question_Basic_Attribute"/>
   <xs:element name="问题解决方法"  type="Question_Method"/> 
  </xs:sequence>
</xs:complexType>

<!--自定义"问题扩展属性"类别-->
<xs:complexType name="Extend_Question">
  <xs:attribute name="id"    type="xs:integer"/>
  <xs:sequence>
   <xs:element name="问题点击量"  type="Question_Basic_Attribute"/>
   <xs:element name="相似问题链接"  type="Question_Basic_Attribute"/>
   <xs:element name="问题答案出处"  type="Question_Basic_Attribute"/>
   <xs:element name="编写者联系方式" type="Question_Connection"/>
  </xs:sequence>
</xs:complexType>

<!--自定义"问题解决方法"类别-->
<xs:complexType name="Question_Method">
  <xs:attribute name="id"    type="xs:string" />
  <xs:attribute name="isCheck"   type="xs:string" />
  <xs:attribute name="isChange"   type="xs:string" />
  <xs:sequence>
   <xs:element name="问题解决方法1" type="Question_Basic_Attribute"/>
   <xs:element name="问题解决方法2" type="Question_Basic_Attribute"/>
   <xs:element name="问题解决方法3" type="Question_Basic_Attribute"/>
  </xs:sequence>
</xs:complexType>

<!--自定义"编写者联系方式"类别-->
<xs:complexType name="Question_Connection">
  <xs:attribute name="id"    type="xs:string" />
  <xs:attribute name="isCheck"   type="xs:string" />
  <xs:attribute name="isChange"   type="xs:string" />
  <xs:sequence>
   <xs:element name="QQ"    type="Question_Basic_Attribute"/>
   <xs:element name="MSN"    type="Question_Basic_Attribute"/>
   <xs:element name="E-MAIL"   type="Question_Basic_Attribute"/>
  </xs:sequence>
</xs:complexType>

<!--自定义元素的属性类别:"id"为问题类别ID."isCheck"为问题类别属性是否"默认选择"."isChange"为问题类别属性"选中状态是否允许修改"-->
<xs:complexType name="Question_Basic_Attribute">
  <xs:attribute name="id"   type="xs:string" />
  <xs:attribute name="isCheck" type="xs:string" />
  <xs:attribute name="isChange" type="xs:string" />
</xs:complexType>

</xs:schema>
说明: 第一句中xmlns:xs="XXXXXXX"表示未命名的名称空间,elementFormDefault="unqualified"就是指XML文件没有资格使用默认名称空间。elementFormDefault="qualified"就是指XML文件有资格使用默认名称空间。 targetNamespace="http://tempuri.org/Question_Attributes_Schema.xsd"
表示被XML文件引用的名称空间

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值