以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  What's wrong with my schema?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=21187)


--  作者:wangtng
--  发布时间:8/16/2005 9:53:00 PM

--  What's wrong with my schema?
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="student">
        <xs:complexType>
      <xs:all>
                <xs:element name="name" type="xs:string"/>
                <xs:group ref="others"/>      
      </xs:all>
      <xs:choice>
                <xs:element name="worktelephone" type="SKU"/>
                <xs:element name="hometelephone" type="SKU"/>      
      </xs:choice>
          <xs:element name="age" type="xs:string"/>       
  </xs:complexType> 
 </xs:element>
 <xs:group name="others">
  <xs:sequence>
  <xs:element name="sex" type="xs:string"/>
  <xs:element name="major" type="xs:string"/>
  </xs:sequence>
 </xs:group>
 <xs:simpleType name="SKU">
  <xs:restriction base="xs:string">
      <xs:pattern value="\d{4}-d{11}"/>
  </xs:restriction>
 </xs:simpleType>
</xs:schema>


错误:
unexpected  child element "xs:group"


--  作者:headman
--  发布时间:8/19/2005 11:14:00 AM

--  
<xs:sequence> and <xs:choice> cann't be set in <xs:all>

If a complexType uses <all> and it extends another type, then that parent type must have empty content.
The <all> element cannot be nested within either <sequence>, <choice>, or another <all>
The contents of <all> must be just elements.  It cannot contain <sequence> or <choice>


--  作者:wangtng
--  发布时间:8/26/2005 7:03:00 AM

--  
谢谢
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms