<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    嘟嘟

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      26 Posts :: 0 Stories :: 6 Comments :: 0 Trackbacks

    定義參數
    <xsd:element name="order">
     <xsd:complexType>
      <xsd:attribute name="shirts" type="xsd:integer"/>
      <xsd:attribute name="mugs" type="xsd:integer"/>
      <xsd:attribute name="hats" type="xsd:integer"/>
     </xsd:complexType>
    </xsd:element>
    XML文件:
    <oeder shirts="9" mugs="3" hats="45">

    參數使用定義
    <xsd:attribute name="hats" type="xsd:integer" use="required"/>                //必須出現
    <xsd:attribute name="hats" type="xsd:integer" use="optional"/>                //可選
    <xsd:attribute name="hats" type="xsd:integer" use="prohibited"/>              //禁止
    <xsd:attribute name="hats" type="xsd:integer" use="fixed" value="value"/>     //如果有這個參數,必須是這個值
    <xsd:attribute name="hats" type="xsd:integer" use="default" value="value"/>   //如果沒有這個參數,自動加上這個參數

    參數和元素
     <xsd:element name="order">
     <xsd:complexType>
      <xsd:sequence>
       <xsd:element name="shirts" type="xsd:string"/>
       <xsd:element name="sweatshirts" type="xsd:string"/>
       <xsd:element name="mugs" type="xsd:string"/>
       <xsd:element name="hats" type="xsd:string"/>
      </xsd:sequence>
      <xsd:attribute name="orderDate" type="xsd:date"/>
      <xsd:attribute name="source" type="xsd:string"/>
     </xsd:complexType>
     </xsd:element>
     XML文件:
     <order orderDate="2001-04-18" source="cellphone">
     <shirt>aaa</shirt>
     <sweatshirts>bbb</sweatshirts>
     <mugs>ccc</mugs>
     <hats>ddd</hats>
     </order>

    參數和text
    <shirt quantity="4">XL purple</shirt>

      <xsd:element name="shirt">
     <xsd:complexType>
      <xsd:simpleContent>
       <xsd:restriction base="xsd:string">                        <!-->文本有限制<-->
        <xsd:maxLength value="30" />
        <xsd:attribute name="quantity" type="xsd:integer"/>
       </xsd:restriction>
      </xsd:simpleContent> >
     </xsd:complexType>
      </xsd:element>

      <xsd:element name="shirt">
     <xsd:complexType>
      <xsd:simpleContent>
       <xsd:extension base="xsd:string">      <!-->文本無限制<-->   
        <xsd:attribute name="quantity" type="xsd:integer"/>
       </xsd:extension>
      </xsd:simpleContent>
     </xsd:complexType>
      </xsd:element>

    參數 text 嵌入元素
     <order orderDate="2001-04-18">
            to ship overnight
     <shirt>9</shirt>
            and
     <mugs>7</mugs>
     to fairfax
     </order>
     <xsd:element name="order">
     <xsd:complexType mixed="true">
      <xsd:sequence>
       <xsd:element name="shirts" type="xsd:string"/>
       <xsd:element name="mugs" type="xsd:string"/>
      </xsd:sequence>
      <xsd:attribute name="orderDate" type="xsd:date"/>
     </xsd:complexType>
     </xsd:element>

    用戶自定義
    <!-- define simple types -->
      <xsd:simpleType name="colorType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="purple" />
      <xsd:enumeration value="orange" />
      <xsd:enumeration value="blue" />
      <xsd:enumeration value="grey" />
     </xsd:restriction>
      </xsd:simpleType>

      <xsd:simpleType name="sizeType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="M" />
      <xsd:enumeration value="L" />
      <xsd:enumeration value="XL" />
     </xsd:restriction>
      </xsd:simpleType>

      <!-- define complex type -->
      <xsd:complexType name="sizeColorType">
     <xsd:sequence>
      <xsd:element name="size" type="sizeType" />
      <xsd:element name="color" type="colorType" />
     </xsd:sequence>
     <xsd:attribute name="quantity" type="xsd:integer" />
      </xsd:complexType>

      使用定義得類型
      <!-- define elements -->
      <xsd:element name="shirt" type="sizeColorType" />

      XML文件:
      <shirt quantity="2">
     <size>M</size>
     <color>blue</color>
      </shirt>

    關聯元素和參數 (重用)
    <xsd:element name="shirt" type="xsd:string" />
    <xsd:element name="shirt_list">
     <xsd:complexType>
      <xsd:sequence>
       <xsd:element ref="shirt" maxOc-curs="unbounded" />
      </xsd:sequence>
     </xsd:complexType>
    </xsd:element>

    <xsd:attribute name="quantity" type="xsd:nonNegativeInteger"/>
    <xsd:complexType name="quantityAttrType">
     <xsd:attribute ref="quantity"/>
    </xsd:complexType>
    <xsd:element name="mugs" type="quantityAttrType"/>
    <xsd:element name="hats" type="quantityAttrType"/>

    建立復雜類型基于已存類型
     <!-- define simple types -->
     <xsd:simpleType name="colorType">
     <xsd:restriction base="xsd:string">
     <xsd:enumeration value="purple"/>
     <xsd:enumeration value="orange"/>
     <xsd:enumeration value="blue"/>
     <xsd:enumeration value="grey"/>
     </xsd:restriction>
     </xsd:simpleType>
     <xsd:simpleType name="sizeType">
     <xsd:restriction base="xsd:string">
     <xsd:enumeration value="M"/>
     <xsd:enumeration value="L"/>
     <xsd:enumeration value="XL"/>
     </xsd:restriction>
     </xsd:simpleType>
     
     
     <!-- define complex types -->
     <xsd:complexType name="sizeColorType">
     <xsd:sequence>
     <xsd:element name="size" type="sizeType"/>
     <xsd:element name="color" type="colorType"/>
     </xsd:sequence>
     <xsd:attribute ref="quantity"/>
     </xsd:complexType>
     
     <xsd:complexType name="shirtDescType">
     <xsd:complexContent>
     <xsd:extension base="sizeColorType">
      <xsd:sequence>
      <xsd:element name="material" type="xsd:string" />
      <xsd:element name="collar" type="xsd:string" />
      <xsd:element name="sleeve" type="xsd:string" />
      </xsd:sequence>
     </xsd:extension>
     </xsd:complexContent>
     </xsd:complexType> 
     
     <!--define attribute -->
     <xsd:attribute name="quantity" type="xsd:nonNegativeInteger"/>
     
     <!-- define element -->
     <xsd:element name="shirt" type="shirtDescType"/>

    元素分組
     <!-- define simple types -->
     <xsd:simpleType name="colorType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="purple"/>
      <xsd:enumeration value="orange"/>
      <xsd:enumeration value="blue"/>
      <xsd:enumeration value="grey"/>
     </xsd:restriction>
     </xsd:simpleType>
     <xsd:simpleType name="sizeType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="M"/>
      <xsd:enumeration value="L"/>
      <xsd:enumeration value="XL"/>
     </xsd:restriction>
     </xsd:simpleType>
      
     <!-- define group -->
     <xsd:group name="sizeColorGroup">
     <xsd:sequence>
      <xsd:element name="size" type="sizeType"/>
      <xsd:element name="color" type="colorType"/>
     </xsd:sequence>
     </xsd:group>

     <!-- define elements -->
     <xsd:element name="shirt">
     <xsd:complexType>
      <xsd:group ref="sizeColorGroup" />
     </xsd:complexType>
     </xsd:element>
     
    參數分組
     <!-- define simple types -->
     <xsd:simpleType name="colorType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="purple"/>
      <xsd:enumeration value="orange"/>
      <xsd:enumeration value="blue"/>
      <xsd:enumeration value="grey"/>
     </xsd:restriction>
     </xsd:simpleType>
     <xsd:simpleType name="sizeType">
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="M"/>
      <xsd:enumeration value="L"/>
      <xsd:enumeration value="XL"/>
     </xsd:restriction>
     </xsd:simpleType>
      
     <!-- define attribute group -->
     <xsd:attributeGroup name="clothesAttrGroup">
     <xsd:attribute name="quantity" type="xsd:nonNegativeInteger" />
     <xsd:attribute name="color" type="colorType" />
     <xsd:attribute name="size" type="sizeType" />
     <xsd:attribute name="material" type="xsd:string" />
     </xsd:attributeGroup>

     <!-- define elements -->
     <xsd:element name="shirt">
     <xsd:complexType>
      <xsd:attributeGroup ref="clothesAttrGroup" />
     </xsd:complexType>
     </xsd:element>
     
    Annotation 和 Documentation
     在schema文件中加入注釋
     <xsd:annotation>
     <xsd:documentation>
      text.....
     </xsd:documentation>
     </xsd:annotation>

    include外部xsd文件
     1: <xsd:include schemaLocation="filename.xsd" />   //不能重定義
     2: <xsd:redefine schemaLocation="shirts.xsd">      //重定義
           ....
        </xsd:redefine>

    posted on 2007-06-15 03:53 fyp1210 閱讀(376) 評論(0)  編輯  收藏 所屬分類: XML
    主站蜘蛛池模板: 国产精品免费视频网站| 亚洲免费观看在线视频| 日本免费无遮挡吸乳视频电影| 91亚洲视频在线观看| 日本免费一区二区在线观看| 亚洲日韩在线视频| 黄瓜视频影院在线观看免费| 亚洲国产系列一区二区三区| 久久久www成人免费毛片| 亚洲人成网站在线在线观看| 永久黄网站色视频免费直播| 黄网站色视频免费观看45分钟| 亚洲精品国精品久久99热 | 亚洲色精品三区二区一区| 好男人www免费高清视频在线| 亚洲国产AV一区二区三区四区| 国产美女无遮挡免费视频| 新最免费影视大全在线播放| 中文字幕不卡亚洲| 99re6免费视频| 日本亚洲色大成网站www久久| 免费国产成人午夜电影| 黄色片免费在线观看| 亚洲手机中文字幕| 哒哒哒免费视频观看在线www| 中文字幕视频免费在线观看| 亚洲成年人电影网站| 国产午夜无码视频免费网站| a级毛片免费在线观看| 亚洲人成在线播放| 亚洲国产婷婷香蕉久久久久久| 男人j进入女人j内部免费网站| 精品丝袜国产自在线拍亚洲| 亚洲国产精品成人| 7m凹凸精品分类大全免费| 亚洲AV成人片无码网站| 亚洲精品无码Av人在线观看国产| 免费黄色福利视频| 免费国产污网站在线观看不要卡| 亚洲最新永久在线观看| 亚洲国产午夜福利在线播放|