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

    >> DTD, XML Schema(XMLS), RELAX NG
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 DTD/XML Schema 』 → 大家帮帮忙,我的XML文档一直不对,大家看看什么毛病。 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 5578 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 大家帮帮忙,我的XML文档一直不对,大家看看什么毛病。 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     提线木偶 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:1
      积分:53
      门派:XML.ORG.CN
      注册:2009/12/4

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给提线木偶发送一个短消息 把提线木偶加入好友 查看提线木偶的个人资料 搜索提线木偶在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看提线木偶的博客楼主
    发贴心情 大家帮帮忙,我的XML文档一直不对,大家看看什么毛病。

    我做的是停车场管理系统,这是XSD文档,验证是正确的。
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- 编辑使用 XMLSpy v2006 U (http://www.altova.com) 由 any (any) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.poi.com" targetNamespace="http://www.poi.com">
     <xs:element name="parks">
      <xs:complexType>
       <xs:sequence>
        <xs:element name="park" minOccurs="0" maxOccurs="unbounded">
         <!--停车场最小数目为0,最大数目不限-->
         <xs:complexType>
          <xs:sequence>
           <xs:element name="parks" type="xs:string"/>
           <xs:element name="district" type="dis"/>
           <!--停车场所在位置,属性为自定义dis-->
           <xs:element name="openTime" type="xs:time"/>
           <xs:element name="closeTime" type="xs:time"/>
           <xs:element name="volumn" type="positiveInt"/>
           <!--停车场容量,类型为自定义类型-->
           <xs:element name="fee" type="positiveFloat"/>
           <!--停车收费,自定义类型,按分钟计算-->
           <xs:element name="status" type="OC"/>
           <!--停车场状态,营业还是关门-->
           <xs:element name="kind" type="PP"/>
           <!--停车场种类,公共的还是小区内部-->
           <xs:element name="sites">
            <!--停车场车位信息-->
            <xs:complexType>
             <xs:sequence>
              <xs:element name="site" maxOccurs="unbounded">
               <!--停车场的车位-->
               <xs:complexType>
                <xs:sequence>
                 <xs:element name="state" type="st"/>
                 <!--停车场车位状态,自定义类型-->
                 <xs:element name="vehicle" minOccurs="0">
                  <!--停车场车位上的车辆信息-->
                  <xs:complexType>
                   <xs:sequence>
                    <xs:element name="style" type="vStyle"/>
                    <!--车辆种类-->
                    <xs:element name="id" type="xs:ID"/>
                    <!--车牌号-->
                   </xs:sequence>
                  </xs:complexType>
                 </xs:element>
                </xs:sequence>
                <xs:attribute name="id" type="xs:ID" use="required"/>
                <!--停车场每个车位编号-->
               </xs:complexType>
              </xs:element>
             </xs:sequence>
             <xs:attribute name="remain" type="positiveInt"/>
             <!--停车场内部还有多少剩余车位,自定义类型-->
            </xs:complexType>
           </xs:element>
          </xs:sequence>
          <xs:attribute name="id" type="xs:ID" use="required"/>
          <!--停车场的编号-->
         </xs:complexType>
        </xs:element>
       </xs:sequence>
      </xs:complexType>
     </xs:element>
     <xs:simpleType name="dis">
      <xs:restriction base="xs:string">
       <xs:enumeration value="丰台区"/>
       <xs:enumeration value="海淀区"/>
       <xs:enumeration value="朝阳区"/>
       <xs:enumeration value="东城区"/>
       <xs:enumeration value="西城区"/>
       <xs:enumeration value="崇文区"/>
       <xs:enumeration value="宣武区"/>
       <xs:enumeration value="石景山区"/>
      </xs:restriction>
      <!--停车场所在区域,自定义类型-->
     </xs:simpleType>
     <xs:simpleType name="positiveInt">
      <xs:restriction base="xs:integer">
       <xs:minInclusive value="0"/>
      </xs:restriction>
      <!--整数类型-->
     </xs:simpleType>
     <xs:simpleType name="positiveFloat">
      <xs:restriction base="xs:float">
       <xs:minInclusive value="0"/>
      </xs:restriction>
      <!--大于零的任意实数类型-->
     </xs:simpleType>
     <xs:simpleType name="OC">
      <xs:restriction base="xs:string">
       <xs:enumeration value="open"/>
       <xs:enumeration value="closed"/>
      </xs:restriction>
      <!--定义停车场的状态-->
     </xs:simpleType>
     <xs:simpleType name="PP">
      <xs:restriction base="xs:string">
       <xs:enumeration value="private"/>
       <xs:enumeration value="public"/>
      </xs:restriction>
      <!--定义停车场的类型-->
     </xs:simpleType>
     <xs:simpleType name="st">
      <xs:restriction base="xs:string">
       <xs:enumeration value="free"/>
       <xs:enumeration value="busy"/>
      </xs:restriction>
      <!--停车场场内的停车位是否空闲-->
     </xs:simpleType>
     <xs:simpleType name="vStyle">
      <xs:restriction base="xs:string">
       <xs:enumeration value="car"/>
       <xs:enumeration value="truck"/>
      </xs:restriction>
      <!--定义车辆类型-->
     </xs:simpleType>
    </xs:schema>



    此主题相关图片如下:
    按此在新窗口浏览图片这是直观图
    <?xml version="1.0" encoding="UTF-8"?>
    <parks xmlns="http://www.poi.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.poi.com
    E:\XML\XML作业\ParkManagementSystem.xsd">
     <park id="1">
      <name>丰台停车场</name>
      <district>丰台区</district>
      <openTime>6:00:00</openTime>
      <closeTime>24:00:00</closeTime>
      <volumn>100</volumn>
      <fee>8.0</fee>
      <status>open</status>
      <kind>public</kind>
      <sites remain="99">
       <site id="1">
        <state>busy</state>
        <vehicle>
         <style>car</style>
         <id>1</id>
        </vehicle>
       </site>
      </sites>
     </park>
    </parks>
    这是XML文档,一直说有错误,希望大家帮个忙。


       收藏   分享  
    顶(0)
      




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

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

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