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

    >> DTD, XML Schema(XMLS), RELAX NG
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 DTD/XML Schema 』 → 请教一个问题 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2759 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: 请教一个问题 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     duckandrat 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:5
      积分:72
      门派:XML.ORG.CN
      注册:2006/7/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给duckandrat发送一个短消息 把duckandrat加入好友 查看duckandrat的个人资料 搜索duckandrat在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看duckandrat的博客楼主
    发贴心情 请教一个问题

    下面是精华区的一个例子 cd.xml
    <?xml version="1.0"?>
    <database xmlns="http://www.newInstance.com/cd-database"
              xmlns:sh="http://www.sugarhillrecords.com"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.newInstance.com/cd-database cd-database.xsd
                                  http://www.sugarhillrecords.com sugarHill.xsd"
    >
      <cd title="Nickel Creek">
        <artist>Nickel Creek</artist>
        <sh:album>
          <sh:description>Bluegrass Revivalists, Acoustic Innovators,
            Youthgrass are just some of the terms that have been used
            to describe Nickel Creek over the past year -- perhaps
            producer Alison Krauss says it best:It's just Nickel Creek
            music.</sh:description>
          <sh:producer>Alison Krauss</sh:producer>
        </sh:album>
      </cd>
      <cd title="Ice Caps: Peaks of Telluride">
        <artist>Sam Bush</artist>
        <sh:album>
          <sh:description>Sam Bush's amazing mandolin and fiddle playing,
            singing and outrageous stage presence have been captivating
            audiences since the late 1960s. So what could be better-or
            more fun-than a live Sam Bush album recorded at the Telluride
            Bluegrass Festival, where he has performed for 26 years?
          </sh:description>
          <sh:producer>Sam Bush</sh:producer>
        </sh:album>
      </cd>
    </database>
    ————————————————————————————————————
    sugarHill.xsd
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.sugarhillrecords.com" targetNamespace="http://www.sugarhillrecords.com" elementFormDefault="qualified">
     <xs:element name="album">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="description" type="xs:string"/>
        <xs:element name="producer" type="xs:string"/>
       </xs:sequence>
      </xs:complexType>
     </xs:element>
    </xs:schema>

    ______________________________________________________________
    cd-database.xsd  代码如下:

    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sh="http://www.sugarhillrecords.com" xmlns:ns1="http://www.newInstance.com/cd-database" targetNamespace="http://www.newInstance.com/cd-database" elementFormDefault="qualified">
     <xs:import namespace="http://www.sugarhillrecords.com" schemaLocation="sugarHill.xsd"/>
     
        <xs:element name="database">
      <xs:complexType>
       <xs:sequence>
        <xs:element ref="cd" maxOccurs="unbounded"/>
       </xs:sequence>
      </xs:complexType>
     </xs:element>
     <xs:element name="cd">
        <xs:complexType>
         <xs:sequence>
         <xs:element name="artist" type="xs:string"/>
         <xs:element ref="sh:albume"/>
         </xs:sequence>
         <xs:attribute name="title" type="xs:string"/>
        </xs:complexType>
     </xs:element>
    </xs:schema>

    当用xmlspy打开时,总出现以下错误提示:
    'cd' must refer to an exsiting element
    可是cd 不是已经定义了吗?
    我是新手,请高手指点错误,谢谢!


       收藏   分享  
    顶(0)
      




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

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

     *树形目录 (最近20个回帖) 顶端 
    主题:  请教一个问题(3005字) - duckandrat,2006年7月13日
        回复:  呃,那就看看是不是有空格,大小写不符(36字) - gemingke,2006年7月13日

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