新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> DTD, XML Schema(XMLS), RELAX NG
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 DTD/XML Schema 』 → 关于schema的一个初级问题……请大师们给点指教……谢谢啦…… 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3320 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 关于schema的一个初级问题……请大师们给点指教……谢谢啦…… 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     kanlin1985 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:1
      积分:60
      门派:XML.ORG.CN
      注册:2007/3/27

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给kanlin1985发送一个短消息 把kanlin1985加入好友 查看kanlin1985的个人资料 搜索kanlin1985在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看kanlin1985的博客楼主
    发贴心情 关于schema的一个初级问题……请大师们给点指教……谢谢啦……

    现在有一个xml文档是这样的:

    <year value = "2000">
          <date month = "7" day = "15">
             <note time = "1430">Doctor&apos;s appointment</note>
             <note time = "1620">Physics class at BH291C</note>
          </date>

          <date month = "7" day = "4">
             <note>Independance Day</note>
          </date>
    </year>

    我想问一下我根据这个xml写的schema哪里需要改进?谢谢啦

    <xs:element name="planner">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="year">
         <xs:complexType>
          <xs:sequence>
           <xs:element ref="date">
           </xs:element>
           <xs:element ref="date">
           </xs:element>
          </xs:sequence>
          <xs:attribute name="value" type="xs:integer">  
          </xs:attribute>
         </xs:complexType>
        </xs:element>
       </xs:sequence>
      </xs:complexType>
     </xs:element>
     <xs:element name="date">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="note" maxOccurs="2" minOccurs="1">
         <xs:complexType>
          <xs:sequence>
          </xs:sequence>
          <xs:attribute name="time" type="xs:integer"/>
          </xs:complexType>
        </xs:element>
       </xs:sequence>
       <xs:attribute name="month" type="xs:integer">
       </xs:attribute>
       <xs:attribute name="day" type="xs:integer">
       </xs:attribute>
      </xs:complexType>
     </xs:element>


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/3/29 21:31:00
     
     gemingke 帅哥哟,离线,有人找我吗?
      
      
      威望:2
      等级:计算机学士学位
      文章:321
      积分:2078
      门派:XML.ORG.CN
      注册:2005/9/21

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给gemingke发送一个短消息 把gemingke加入好友 查看gemingke的个人资料 搜索gemingke在『 DTD/XML Schema 』的所有贴子 点击这里发送电邮给gemingke 引用回复这个贴子 回复这个贴子 查看gemingke的博客2
    发贴心情 
    你的schema有错误,在定义note那里

    我给你更正如下

    <xs:element name="planner">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="year" type="yearType"/>
       </xs:sequence>
      </xs:complexType>
     </xs:element>
     <xs:complexType name="yearType">
      <xs:sequence>
       <xs:element ref="date" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="value" type="xs:positiveInteger"/>
     </xs:complexType>
     <xs:element name="date">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="note" type="noteType" maxOccurs="unbounded"/>
       </xs:sequence>
       <xs:attribute name="month" type="xs:positiveInteger"/>
       <xs:attribute name="day" type="xs:positiveInteger"/>
      </xs:complexType>
     </xs:element>
     <xs:complexType name="noteType">
      <xs:simpleContent>
       <xs:extension base="xs:string">
        <xs:attribute name="time" type="xs:nonNegativeInteger"/>
       </xs:extension>
      </xs:simpleContent>
     </xs:complexType>

    ----------------------------------------------
    天下英雄谁敌手?曹刘,生子当如孙仲谋!

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/3/30 13:45:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 DTD/XML Schema 』的所有贴子 点击这里发送电邮给Google AdSense 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/19 19:53:22

    本主题贴数2,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    62.500ms