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

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

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 4736 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 作业,求人写一个XML的SCHEMA(急) 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     yorsal 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:56
      门派:XML.ORG.CN
      注册:2008/3/6

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

    <?xml version="1.0"?>
    <customers xsi:noNamespaceSchemaLocation="schema01.xsd"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

     <customer cno="C111" corporate="false">
      <cname>
       <gName>Bilbo</gName>
       <fName>Baggins</fName>
      </cname>
      <caddress>
       <cstreet>21 Bag End</cstreet>
       <csuburb>Hobbiton</csuburb>
       <cstate>VIC</cstate>
       <cpostcode>3077</cpostcode>
      </caddress>
      <contacts>
       <home primary="true">(03) 9903-3401</home>
       <office>(03) 9903-3401</office>
       <mobile>04111222333</mobile>
      </contacts>
     </customer>
     <customer cno="C222" corporate="true">
      <cname>
       <companyName>PBL Ltd</companyName>
      </cname>
      <caddress>
       <cstreet>10 Rich Road</cstreet>
       <csuburb>Moneytown</csuburb>
       <cstate>VIC</cstate>
       <cpostcode>3454</cpostcode>
      </caddress>
      <contacts>
       <name>James Packer</name>
       <office primary="true">(03) 9111-9999</office>
       <mobile>04111222444</mobile>
      </contacts>
      <flights>
       <flight no="F112">
        <flightDate>2007-06-21</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Melbourne</dest>
         <seats>7</seats>
         <seatPrice>250</seatPrice>
         <discount>2</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Sydney</dest>
         <seats>20</seats>
         <seatPrice>225</seatPrice>
         <discount>5</discount>
        </flightDetail>
       </flight>
       <flight no="F121">
        <flightDate>2006-01-20</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Albury</dest>
         <seats>25</seats>
         <seatPrice>57.50</seatPrice>
         <discount>0</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Sydney</dest>
         <seats>34</seats>
         <seatPrice>215</seatPrice>
         <discount>5</discount>
        </flightDetail>
       </flight>
       <flight no="F111">
        <flightDate>2007-04-12</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Hobart</dest>
         <seats>4</seats>
         <seatPrice>125</seatPrice>
         <discount>0</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Melbourne</dest>
         <seats>100</seats>
         <seatPrice>190</seatPrice>
         <discount>10</discount>
        </flightDetail>
       </flight>
      </flights>
     </customer>
     <customer cno="C333" corporate="false">
      <cname>
       <gName>Clark</gName>
       <fName>Kent</fName>
      </cname>
      <caddress>
       <cstreet>10 Super St</cstreet>
       <csuburb>Smallville</csuburb>
       <cstate>VIC</cstate>
       <cpostcode>3622</cpostcode>
      </caddress>
      <contacts>
       <home>(03) 9111-3333</home>
       <office>(03) 9111-9999</office>
       <mobile primary="true">04111222444</mobile>
      </contacts>
      <flights>
       <flight no="F113">
        <flightDate>2006-01-21</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Adelaide</dest>
         <seats>2</seats>
         <seatPrice>300</seatPrice>
         <discount>20</discount>
        </flightDetail>
       </flight>
       <flight no="F114">
        <flightDate>2007-07-10</flightDate>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Perth</dest>
         <seats>2</seats>
         <seatPrice>400</seatPrice>
         <discount>20</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L003</legNo>
         <dest>Rottnest Island</dest>
         <seats>2</seats>
         <seatPrice>55.5</seatPrice>
         <discount>5</discount>
        </flightDetail>
       </flight>
       <flight no="F122">
        <flightDate>2007-01-01</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Darwin</dest>
         <seats>32</seats>
         <seatPrice>230</seatPrice>
         <discount>20</discount>
        </flightDetail>
       </flight> 
       <flight no="F115">
        <flightDate>2007-07-11</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Bendigo</dest>
         <seats>20</seats>
         <seatPrice>100</seatPrice>
         <discount>10</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Ballarat</dest>
         <seats>20</seats>
         <seatPrice>50</seatPrice>
         <discount>10</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L003</legNo>
         <dest>Albury</dest>
         <seats>20</seats>
         <seatPrice>75</seatPrice>
         <discount>10</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L004</legNo>
         <dest>Wangaratta</dest>
         <seats>20</seats>
         <seatPrice>66</seatPrice>
         <discount>10</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L005</legNo>
         <dest>Wyong</dest>
         <seats>20</seats>
         <seatPrice>45</seatPrice>
         <discount>0</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L006</legNo>
         <dest>Newcastle</dest>
         <seats>20</seats>
         <seatPrice>110</seatPrice>
         <discount>10</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L007</legNo>
         <dest>Tweed Heads</dest>
         <seats>20</seats>
         <seatPrice>89</seatPrice>
         <discount>10</discount>
        </flightDetail>
       </flight>
      </flights>
     </customer>
     <customer cno="C444" corporate="false">
      <cname>
       <gName>Peter</gName>
       <fName>Pan</fName>
      </cname>
      <caddress>
       <cstreet>23 Never Street</cstreet>
       <csuburb>Never Never Land</csuburb>
       <cstate>WA</cstate>
       <cpostcode>6200</cpostcode>
      </caddress>
      <contacts>
       <home>(06) 6222-3333</home>
       <office>(06) 6222-9999</office>
       <mobile primary="true">04111222555</mobile>
      </contacts>
      <flights>
       <flight no="F116">
        <flightDate>2007-12-12</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Melbourne</dest>
         <seats>1</seats>
         <seatPrice>200</seatPrice>
         <discount>0</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L002</legNo>
         <dest>Sydney</dest>
         <seats>4</seats>
         <seatPrice>190</seatPrice>
         <discount>3</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L003</legNo>
         <dest>Brisbane</dest>
         <seats>9</seats>
         <seatPrice>150</seatPrice>
         <discount>0</discount>
        </flightDetail>
       </flight>
       <flight no="F117">
        <flightDate>2007-06-16</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Darwin</dest>
         <seats>10</seats>
         <seatPrice>400</seatPrice>
         <discount>0</discount>
        </flightDetail>
       </flight>
       <flight no="F123">
        <flightDate>2007-06-17</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Albury</dest>
         <seats>30</seats>
         <seatPrice>187</seatPrice>
         <discount>0</discount>
        </flightDetail>
       </flight>
      </flights>
     </customer>
     <customer cno="C555" corporate="false">
      <cname>
       <gName>Bruce</gName>
       <fName>Wayne</fName>
      </cname>
      <caddress>
       <cstreet>23 Batman Ave</cstreet>
       <csuburb>Gotham City</csuburb>
       <cstate>WA</cstate>
       <cpostcode>6500</cpostcode>
      </caddress>
      <contacts>
       <home>(06) 6222-4444</home>
       <office>(06) 6222-9999</office>
       <mobile primary="true">04111222666</mobile>
      </contacts>
      <flights>
       <flight no="F120">
        <flightDate>2007-05-05</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Sydney</dest>
         <seats>15</seats>
         <seatPrice>200</seatPrice>
         <discount>4</discount>
        </flightDetail>
       </flight>
      </flights>
     </customer>
     <customer cno="C666" corporate="true">
      <cname>
       <companyName>Newscorp</companyName>
      </cname>
      <caddress>
       <cstreet>1 News Drive</cstreet>
       <csuburb>Subiaco</csuburb>
       <cstate>WA</cstate>
       <cpostcode>6666</cpostcode>
      </caddress>
      <contacts>
       <name>Rupert Murdoch</name>
       <office primary="true">(06) 6222-9999</office>
       <mobile>04111222555</mobile>
      </contacts>
      <flights>
       <flight no="F118">
        <flightDate>2007-04-12</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Burnie</dest>
         <seats>2</seats>
         <seatPrice>125</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Strachan</dest>
         <seats>2</seats>
         <seatPrice>60</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Queenstown</dest>
         <seats>2</seats>
         <seatPrice>45</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Hobart</dest>
         <seats>2</seats>
         <seatPrice>125</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Launceston</dest>
         <seats>2</seats>
         <seatPrice>78</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Melbourne</dest>
         <seats>2</seats>
         <seatPrice>125</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Geelong</dest>
         <seats>2</seats>
         <seatPrice>50</seatPrice>
         <discount>5</discount>
        </flightDetail>
       </flight>
       <flight no="F119">
        <flightDate>2007-07-01</flightDate>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Sydney</dest>
         <seats>25</seats>
         <seatPrice>225</seatPrice>
         <discount>5</discount>
        </flightDetail>
        <flightDetail>
         <legNo>L001</legNo>
         <dest>Newcastle</dest>
         <seats>25</seats>
         <seatPrice>125</seatPrice>
         <discount>0</discount>
        </flightDetail>
       </flight>
      </flights>
     </customer>
    </customers>


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/6 15:05:00
     
     yorsal 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:2
      积分:56
      门派:XML.ORG.CN
      注册:2008/3/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yorsal发送一个短消息 把yorsal加入好友 查看yorsal的个人资料 搜索yorsal在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看yorsal的博客2
    发贴心情 
    这个是我自己写的,在XMLWRITER下面出错,不知道怎么调试,高手帮忙啊

    <?xml version="1.0"?>

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <xsd:annotation>
        <xsd:documentation>
          This XML Schema is for the customer flights XML file
          This Schema file is called "schema01.xsd"
        </xsd:documentation>
      </xsd:annotation>
      
      <!-- ********************1st layer************************* -->
      <!-- ROOT -->
      <xsd:element name="customers" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="customer" maxOccurs="unbounded"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      
      <!-- ********************2nd layer************************* -->
      <!-- CUSTOMER ELEMENT -->  
      <xsd:element name="customer" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="cname"/>
        <xsd:element ref="caddress"/>
        <xsd:element ref="contacts"/>
        <xsd:element ref="flights" minOccurs="0"/>
       </xsd:sequence>
       <!-- ATTRIBUTE -->
       <xsd:attribute name="cno" type="xsd:string" use="required"/>
       <xsd:attribute name="corporate" type="xsd:boolean" use="required"/>
       
     </xsd:complexType>
      </xsd:element>
      
      <!-- CNAME ELEMENT -->
      <xsd:element name="cname" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="gName" minOccurs="0"/>
        <xsd:element ref="fName" minOccurs="0"/>
        <xsd:element ref="companyName" minOccurs="0"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      <!-- CADDRESS ELEMENT -->  
      <xsd:element name="caddress" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="cstreet"/>
        <xsd:element ref="csuburb"/>
        <xsd:element ref="cstate"/>
        <xsd:element ref="cpostcode"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      <!-- CONTACTS ELEMENT -->
      <xsd:element name="contacts" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:choice>
        <xsd:element ref="home"/>
        <xsd:element ref="name"/>
      </xsd:choice>
      <xsd:element ref = "mobile"/>
      <xsd:element ref = "office"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      <!-- FLIGHTS ELEMENT -->  
      <xsd:element name="flights" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="flight" maxOccurs="4"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      
      <!-- ********************3rd layer************************* -->
      <!-- GNAME&FNAME ELEMENT -->
      <xsd:element name="gName" type="xsd:string"/>
      <xsd:element name="fName" type="xsd:string"/>
      <xsd:element name="companyName" type="xsd:string"/>
      
      <!-- STREET&SUBURB&STATE&POSTCODE ELEMENT -->
      <xsd:element name="cstreet" type="xsd:string"/>
      <xsd:element name="csuburb" type="xsd:string"/>
      <xsd:element name="cstate" type="xsd:string"/>
      <xsd:element name="cpostcode" type="xsd:integer"/>
      
      <!-- MOBILE&HOME&OFFICE&NAME ELEMENT -->
      <xsd:element name="name" type="xsd:string"/>
      
      <xsd:element name="home">  
     <xsd:complexType>
       <xsd:attribute name="primary" type="xsd:boolean" use="optional"/>
     </xsd:complexType>
      </xsd:element>
      <xsd:element name="mobile">  
     <xsd:complexType>
       <xsd:attribute name="primary" type="xsd:boolean" use="optional"/>
     </xsd:complexType>
      </xsd:element>
      
      <xsd:element name="office">  
     <xsd:complexType>
       <xsd:attribute name="primary" type="xsd:boolean" use="optional"/>
     </xsd:complexType>
      </xsd:element>
      
      <!-- FLIGHT ELEMENT -->  
      <xsd:element name="flight" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="flightDate"/>
        <xsd:element ref="flightDetail" maxOccurs="7"/>
       </xsd:sequence>
       <!-- ATTRIBUTE -->
       <xsd:attribute name = "no" type="xsd:string" />
     </xsd:complexType>
      </xsd:element>


      <!-- ********************4th layer************************* -->
      <!-- FLIGHTDATE ELEMENT -->
      <xsd:element name="flightDate" type="xsd:integer"/>
      
      <!-- FLIGHTDETAIL ELEMENT -->
      <xsd:element name="flightDetail" >  
     <xsd:complexType>
       <xsd:sequence>
        <xsd:element ref="legNo"/>
        <xsd:element ref="dest"/>
        <xsd:element ref="seats"/>
        <xsd:element ref="seatPrice"/>
        <xsd:element ref="discount"/>
       </xsd:sequence>
     </xsd:complexType>
      </xsd:element>
      
      <!-- LEGNO&DEST.. ELEMENT -->
      <xsd:element name="legNo" type="xsd:integer"/>
      <xsd:element name="dest" type="xsd:string"/>
      <xsd:element name="seats" type="xsd:integer"/>
      <xsd:element name="seatPrice" type="xsd:integer"/>
      <xsd:element name="discount" type="xsd:integer"/>

    </xsd:schema>

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

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

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