zoukankan      html  css  js  c++  java
  • webservice学习 模式《schema1》

    Webservice 笔记:

     

    练习:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

       <xs:element name="Orders">

          <xs:complexType>

             <xs:sequence>

                <xs:element name="Order" minOccurs="0" maxOccurs="unbounded">

                    <xs:complexType>

                       <xs:group ref="ordergroup"/>

                       <xs:attributeGroup ref="orderatt"/>

                    </xs:complexType>

                </xs:element>

             </xs:sequence>

          </xs:complexType>

       </xs:element>

       <xs:group name="ordergroup">

          <xs:sequence>

             <xs:element name="name" type="xs:string"/>

             <xs:element name="number" type="numbertype"/>

             <xs:element name="city" type="xs:string"/>

             <xs:element name="zip" type="ziptype" minOccurs="0"/>

             <xs:element name="phoneno" type="phonetype"/>

          </xs:sequence>

       </xs:group>

       <xs:simpleType name="numbertype">

          <xs:restriction base="xs:positiveInteger">

             <xs:minInclusive value="1"/>

             <xs:maxInclusive value="999"/>

          </xs:restriction>

       </xs:simpleType>

       <xs:simpleType name="ziptype">

          <xs:restriction base="xs:string">

             <xs:pattern value="d{6}"/>

          </xs:restriction>

       </xs:simpleType>

       <xs:simpleType name="phonetype">

          <xs:restriction base="xs:string">

             <xs:pattern value="d{4}-d{8}"/>

          </xs:restriction>

       </xs:simpleType>

       <xs:attributeGroup name="orderatt">

          <xs:attribute name="orderID">

             <xs:simpleType>

                <xs:restriction base="xs:string">

                    <xs:length value="4"/>

                    <xs:pattern value="[A]d{3}"/>

                </xs:restriction>

             </xs:simpleType>

          </xs:attribute>

          <xs:attribute name="orderDate">

             <xs:simpleType>

                <xs:restriction base="xs:date"/>

             </xs:simpleType>

          </xs:attribute>

       </xs:attributeGroup>

    </xs:schema>

     

     

     

    实例文件:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <Orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///F:/Record/webservice/Orders.xsd">

    <Order orderID="A002" orderDate="2014-11-30">

          <name>文具</name>

          <number>17</number>

          <city>青岛</city>

          <phoneno>0543-12345678</phoneno>

       </Order>

       <Order orderID="A003" orderDate="2014-11-28">

          <name>书籍</name>

          <number>233</number>

          <city>滨州</city>

          <phoneno>0543-18363979</phoneno>

       </Order>

     

    </Orders>

     

     

    如果没有一直坚持,也不会有质的飞跃,当生命有了限度,每个人的价值就会浮现。
  • 相关阅读:
    WPF---数据模板(一)
    Oracle 相关知识
    Oracle 11g数据库详细安装步骤图解
    Mysql优化
    CSharp 相关知识点小结
    JS Date当前时间:获取日期时间方法在各浏览器中的差异
    【转】IE8浏览器无法保存Cookie的解决方法
    8 种提升 ASP.NET Web API 性能的方法
    DotNet 资源大全【转】
    DotNet 资源大全中文版【转】
  • 原文地址:https://www.cnblogs.com/shiguangshuo/p/4133289.html
Copyright © 2011-2022 走看看