以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  还是schema嵌套的问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=8198)


--  作者:chenys
--  发布时间:6/8/2004 3:16:00 PM

--  还是schema嵌套的问题
例子如下,盼望高手解答
<tree>
  <orderItem>
          <orderItem>
                  <orderItem>
                          ...
                                 <orderItem>xx</orderItem>
                          ...
                  </orderItem>
          </orderItem>
  </orderItem>
</tree>
orederitem会一层一层嵌套下去,schema如何设置呢?
--  作者:admin
--  发布时间:6/8/2004 3:50:00 PM

--  
是不是只有最里层的元素才能有xx,其他的orderItem只能包含orderItem元素?

xx是不是只能是正数?


--  作者:chenys
--  发布时间:6/8/2004 4:02:00 PM

--  
xx只是个比方,每层都可以有xx和相关的属性,数据类型不限,关键是曾数是未知的,如何设定这个schema呢?
--  作者:admin
--  发布时间:6/8/2004 5:29:00 PM

--  
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <xsd:complexType name="orderItem" mixed="true">
  <xsd:sequence>
   <xsd:element name="orderItem" type="orderItem" minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:element name="tree">
  <xsd:complexType mixed="true">
   <xsd:sequence>
    <xsd:element name="orderItem" type="orderItem"/>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
</xsd:schema>


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