xml schema 语法

元素声明:
<element name= "QName"   ref="QName"  type="QName"
                use = "optional | prohibited| required"
                form="qualified | unqualified"
                id = "ID"  default="String" fixed= "String" >
Content :(annotation?,((simpleType| complexType)?,(unique | key|keyref)*))
</element>
  default fixed属性不能同时出现
  如果该元素与另一个模式成分内局部地声明(不包括Schema元素),ref和name属性必须有一个得到使用。
  如果ref属性得到使用,除了ref属性之外,只允许出现minOccurs,maxOccurs和id属性。
  如果ref属性得到使用,只用annotation元素可能会定义为该声明的一个子元素。
                
属性声明:
<attribute name="QName" ref="QName" type="QName"
                use="optional|prohibited |required"
                form="qualified |unqualified"
                id="ID" default="String" fixed="String"
                {any attributes with non-schema namespace}
>
  content:(annotation?,(simpleType?))
</attribute>
 命名该属性或者引用另一个属性。

复杂类型定义
<complexType abstract="boolean" block="#all | List of (extension | restriction)"
             final="#all | List of (extension | restriction)"
             id="ID"  mixe"boolean"  name="NCName"
             {any attributes with non-schema namespace}
>
  Content :(annotation?, (simpleContent | complexContent
           ((group | all | choice | sequence)?, ((attribute | attributeGroup)*                      ,anyAttribute?))))
</complexType>

属性组定义
<attributeGroup id="ID" name="NCName" ref="QName" {带有非模式名称空间的任何属性}>
Content:(annotation?,((attribute |  attributeGroup)*, anyAttribute?))
</attributeGroup>

模型组定义
<group name="NCName" ref="NCName" maxOccurs= "nonNegativeInteger | unbounded"
                            minOccurs="nonNegativeInteger"      id="ID"
>
Content:(annotation?,(all| choice |sequence))
</group>

通配符
<any id="ID"   maxOccurs="nonNegativeInteger | unbounded" 
               minOccurs="nonNegativeInteger"
               namespace="(##any | ##other)| List of (anyURI | (##targetNamespace |                                ##local))"
               processContent ="lax| skip |strict"   { 带有非模式名称空间的任何属性}
>
Content:(annotation?)
</any>
<anyAttribute id="ID" namespace="(##any | ##other) | List of (anyURI | (##targetNamespace |                           ##local))" processContents="lax |skip| strict"
                            { 带有非模式名称空间的任何属性}
>
Content:(annotation?)
</anyAttribute>

##any  新元素可以属于任一名称空间
##other 新元素可以属于除模式模型所定义的目标名称空间之外的任一名称空间
##targetNamespace 新元素必须属于模式模型所定义的目标名称空间
##local 新元素不能属于任何名称空间
anyURI 创建者可以定义元素必须属于的一个名称空间URI

本体约束定义
    唯一
  <unique id="ID" name="NCName" {带有非模式名称空间的任何属性}
   Content:(annotation?,(selector,field+))
  </unique>
   关键字
  <KEY ID="ID" name="NCName"    {带有非模式名称空间的任何属性}>
  Content:(annotation?,(selector,field+))
  </KEY>
 
  <keyref id="ID" name="NCName" refer="QName"   {带有非模式名称空间的任何属性}>
  Content:(annotation?,(selector,field+))
  </keyref>
  
selector元素表示此节点集 field元素标识必须是唯一的那个元素或属性。XPath表达式用来选择一个元素或属性。
   <selector id="ID" xpath="XPath表达式子集"  {带有非模式名称空间的任何属性}>
    Content:(annotation?)
   </selector>
   <field id="ID"  xpath="XPath表达式子集"  {带有非模式名称空间的任何属性}>
   Content :(annotation?)
   </field>

表示法声明
<notation id="ID" name="NCName" public="anyURI" system="anyURI"  {带有非模式名称空间的任何属性}>
Content:(annotation?)
</notation>
注解
<annotation id="ID"  {带有非模式名称空间的任何属性}>
Content :(appInfo | documentation)*
</annotation>

简单类型定义
<simpleType final="#all | (list |union | restriction)" id="ID" name="NCName"  {带有非模式名称空间的任何属性}>
Content :(annotation?,(restriction | list |union))
</simpleType> 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值