tempad
Readygo技术搜索引擎 >>游戏开发 >> 大家帮忙看看符合这个schema的XML文件该怎样写?

大家帮忙看看符合这个schema的XML文件该怎样写?

Readygo技术搜索引擎 网络搜索 efish 2008-1-17 2:00:39

大家帮忙看看符合这个schema的XML文件该怎样写?

楼主Salif(11)2002-11-22 17:33:25 在 Web 开发 / XML/SOAP 提问

<?xml   version="1.0"   encoding="gb2312"?>  
  <xsd:schema   xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
          targetNamespace="http://www.litw.com.cn"  
          xmlns="http://www.litw.com.cn">  
           
  <xsd:element   name="weather_forecast"   type="weather_type"/>  
   
  <xsd:complexType   name="weather_type">  
  <xsd:sequence>  
  <xsd:element   ref="weather_data"   maxOccurs="unbounded"/>  
  </xsd:sequence>  
  <xsd:attribute   name="date"   type="xsd:date"   use="required"/>  
  <xsd:attribute   name="source"   type="xsd:uri"   fixed="http://www.nmc.gov.cn"/>  
  </xsd:complexType>  
   
  <xsd:element   name="weather_data">  
  <xsd:complexType>  
  <xsd:sequence>  
  <xsd:element   ref="province"/>  
  <xsd:element   ref="capital"/>  
  </xsd:sequence>  
  </xsd:complexType>  
  </xsd:element>  
   
  <xsd:element   name="province">  
  <xsd:complexType>  
  <xsd:simpleContent>  
          <xsd:extension   base="xsd:string">  
                <xsd:attribute     name="shortening"     type="xsd:string"   use="required"/>  
          </xsd:extension>  
  </xsd:simpleContent>  
  </xsd:complexType>  
  </xsd:element>  
   
  <xsd:element   name="capital">  
  <xsd:complexType>  
  <xsd:simpleContent>  
  <xsd:extension   base="xsd:string">  
  <xsd:attribute   name="skies"   type="skies_type"   use="required"/>  
  <xsd:attribute   name="high"   type="temperature"   use="required"/>  
  <xsd:attribute   name="low"   type="temperature"   use="required"/>  
  <xsd:attribute   name="wind"   type="wind_power"   use="required"/>  
  </xsd:extension>  
  </xsd:simpleContent>  
  </xsd:complexType>  
  </xsd:element>  
   
  <xsd:simpleType   name="skies_type">  
  <xsd:restriction   base="xsd:string:>  
  <xsd:enumeration   value="晴"/>  
  <xsd:enumeration   value="多云"/>  
  <xsd:enumeration   value="雨"/>  
  <xsd:enumeration   value="雪"/>  
  <xsd:enumeration   value="多云有时晴"/>  
  <xsd:enumeration   value="晴有时有多云"/>  
  </xsd:restriction>  
  </xsd:simpleType>  
   
   
  <xsd:simpleType     name="temperature">  
  <xsd:restriction   base="xsd:integer">  
            <xsd:minInclusive   value="-50"/>  
                      <xsd:maxInclusive   value="50"/>  
  </xsd:restriction>  
  </xsd:simpleType>  
   
  <xsd:simpleType   name="wind_power">  
  <xsd:restriction   base="xsd:unsignedByte">  
            <xsd:maxInclusive   value="12"/>  
  </xsd:restriction>  
  </xsd:simpleType>  
   
  </xsd:schema>  
  我的XML文件错在哪?  
  <?xml   version="1.0"   encoding="gb2312"?>  
  <weather_forecast   xmlns="http://www.litw.com.cn"  
                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
              xsi:schemaLocation="http://www.litw.com.cn   weather.xsd"  
              date="2002-11-28"  
              source="http://www.nmc.gov.cn">  
     
     
        <weather_data>  
              <province   shortening="My   province">  
              </province>  
               
               
              <capital   skies="多云",high="34",low="21",wind_power="11">  
              </capital>  
              </weather_data>  
                                       
  </weather_forecast> 问题点数:20、回复次数:1Top

1 楼SuhongSuper(彩缘书童)回复于 2002-11-22 20:43:50 得分 20

你的这一句错了:  
  <capital   skies="多云",high="34",low="21",wind_power="11">  
  </capital>  
  在XML中,属性之间是不需要加任何符号的,包括逗号在内。  
  另外,还在把wind_power改在wind才行,因为wind才是<capital>的一个属性名,而wind_power不是,它只是wind的类型。  
  好了,最后祝君好运!!Top

责任编辑: efish 参与评论 查找更多:
相关文章
程序报错为:PL/SQL: 数字或值错误 : 字符串缓冲区太… 程序报错为:PL/SQL: 数字或值错误 : 字符串缓冲区太小
关于表单的保存问题!(内详) 关于表单的保存问题!(内详)
(求助)Tomcat配置连接池问题?迷惑~~(在线等) (求助)Tomcat配置连接池问题?迷惑~~(在线等)
关于 散分帖子之十二的分(给 {猛禽} 的200分) 关于 散分帖子之十二的分(给 {猛禽} 的200分)
怎么将vb声明转为C#的声明 怎么将vb声明转为C#的声明
sysdba、sysoper、normal在登陆connect as时的区别?… sysdba、sysoper、normal在登陆connect as时的区别?谢谢!
如何在word的工具栏中增加一个用于查询的控件? 如何在word的工具栏中增加一个用于查询的控件?
100feng求解16进制转换字符问题 100feng求解16进制转换字符问题
NoClassDefFoundError: oracle/sql/ClobDBAccess!!… NoClassDefFoundError: oracle/sql/ClobDBAccess!!困绕好多日子了,向zez前辈及各位熟悉weblogic+oracle应用的大侠求救!!!一定送分
怎样备份Anywhere 怎样备份Anywhere
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn

分类导航
Readygo技术搜索引擎