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

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

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

    嘟嘟

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      26 Posts :: 0 Stories :: 6 Comments :: 0 Trackbacks

    定義參數(shù)
    <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">

    參數(shù)使用定義
    <xsd:attribute name="hats" type="xsd:integer" use="required"/>                //必須出現(xiàn)
    <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"/>     //如果有這個(gè)參數(shù),必須是這個(gè)值
    <xsd:attribute name="hats" type="xsd:integer" use="default" value="value"/>   //如果沒有這個(gè)參數(shù),自動(dòng)加上這個(gè)參數(shù)

    參數(shù)和元素
     <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>

    參數(shù)和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">      <!-->文本無(wú)限制<-->   
        <xsd:attribute name="quantity" type="xsd:integer"/>
       </xsd:extension>
      </xsd:simpleContent>
     </xsd:complexType>
      </xsd:element>

    參數(shù) 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>

    關(guān)聯(lián)元素和參數(shù) (重用)
    <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"/>

    建立復(fù)雜類型基于已存類型
     <!-- 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>
     
    參數(shù)分組
     <!-- 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 閱讀(377) 評(píng)論(0)  編輯  收藏 所屬分類: XML
    主站蜘蛛池模板: 青青青青青青久久久免费观看| 99久久国产免费-99久久国产免费| 亚洲人成免费电影| 亚洲精品午夜久久久伊人| 免费视频成人片在线观看| 久久亚洲精品成人无码网站| 无码人妻一区二区三区免费看| 亚洲国产精品热久久| 国产免费一区二区三区在线观看| 亚洲人成亚洲精品| 日韩一区二区a片免费观看 | 国产成人无码免费视频97| 亚洲欧美日韩中文二区| 国产a不卡片精品免费观看| 老司机午夜在线视频免费观| 亚洲精品国产福利一二区| 国产色爽免费无码视频| 亚洲高清中文字幕| 成人黄软件网18免费下载成人黄18免费视频 | 成人毛片100免费观看| 亚洲AV日韩精品久久久久久久| 性色午夜视频免费男人的天堂| 亚洲免费闲人蜜桃| 国产免费怕怕免费视频观看| 中文字幕不卡免费高清视频| 亚洲成人免费网站| 国产成人精品免费视频软件| 免费无码一区二区三区蜜桃| 亚洲欧洲日产韩国在线| 国产又粗又长又硬免费视频| 精品97国产免费人成视频| 亚洲最大在线观看| 亚洲成av人片在线观看天堂无码| 久久免费精品视频| 亚洲日韩中文字幕一区| 狠狠综合久久综合88亚洲| 91精品国产免费久久国语蜜臀 | 亚洲香蕉久久一区二区三区四区| 亚洲AV无码成人精品区大在线| 久久国产精品萌白酱免费| 亚洲精品无码专区在线|