⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 soap4.htm

📁 这是一个实现登陆的页面程序
💻 HTM
📖 第 1 页 / 共 5 页
字号:
            <P><BR>复合值的成员被编码为存取标识元素。存取标识由他们的名字来相区别(例如在struct里面),而元素名就是存取标识名。存取标识名是局部的,作用域是包含他们的类型中,具备一个未修饰的元素名,而其他则有完全修饰名。</P>
            <P></P>
            <P>下面是一个“Book”结构的例子:</P>
            <P></P>
            <P></P>
            <P>Example 18</P>
            <P><BR>&lt;e:Book xmlns:e="http://example.org/2001/06/books" &gt; 
            &lt;author&gt;Henry Ford&lt;/author&gt; &lt;preface&gt;Prefactory 
            text&lt;/preface&gt; &lt;intro&gt;This is a 
            book.&lt;/intro&gt;&lt;/e:Book&gt;</P>
            <P><BR>Book structure</P>
            <P><BR>下面则是一个描述该结构的模式片段:</P>
            <P></P>
            <P></P>
            <P>Example 19</P>
            <P><BR>&lt;xs:element name="Book" 
            xmlns:xs='http://www.w3.org/2001/XMLSchema' &gt; 
            &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element 
            name="author" type="xs:string" /&gt; &lt;xs:element name="preface" 
            type="xs:string" /&gt; &lt;xs:element name="intro" type="xs:string" 
            /&gt; &lt;/xs:sequence&gt; 
            &lt;/xs:complexType&gt;&lt;/xs:element&gt;</P>
            <P><BR>Schema for Example 18</P>
            <P><BR>下面是一个即包含简单类型成员也包含复合类型成员的类型的例子。它显示了两层的引用。注意“Author”存取标识元素的“href”属性一个对匹配“id”值对应的值的引用。“Address”中的情况也是类似的。</P>
            <P></P>
            <P></P>
            <P>Example 20</P>
            <P><BR>&lt;e:Book xmlns:e="http://example.org/2001/06/books" &gt; 
            &lt;title&gt;My Life and Work&lt;/title&gt; &lt;author 
            href="#Person-1"/&gt;&lt;/e:Book&gt;&lt;e:Person 
            xmlns:e="http://example.org/2001/06/books" id="Person-1" &gt; 
            &lt;name&gt;Henry Ford&lt;/name&gt; &lt;address 
            href="#Address-2"/&gt;&lt;/e:Person&gt;&lt;e:Address 
            xmlns:e="http://example.org/2001/06/books" id="Address-2" &gt; 
            &lt;email&gt;mailto:henryford@hotmail.com&lt;/email&gt; 
            &lt;web&gt;http://www.henryford.com&lt;/web&gt;&lt;/e:Address&gt;</P>
            <P><BR>Book with muli-reference addresses</P>
            <P><BR>当“Person”和“Address”的值是需要多引用的时候,上述描述是合适的。如果使用单引用来描述,则应该是嵌入的,如下:</P>
            <P></P>
            <P></P>
            <P>Example 21</P>
            <P><BR>&lt;e:Book xmlns:e="http://example.org/2001/06/books" &gt; 
            &lt;title&gt;My Life and Work&lt;/title&gt; &lt;author&gt; 
            &lt;name&gt;Henry Ford&lt;/name&gt; &lt;address&gt; 
            &lt;email&gt;mailto:henryford@hotmail.com&lt;/email&gt; 
            &lt;web&gt;http://www.henryford.com&lt;/web&gt; &lt;/address&gt; 
            &lt;/author&gt;&lt;/e:Book&gt;</P>
            <P><BR>Book with single-reference addresses</P>
            <P><BR>如果这里存在着一个限制:在一个给出的实例中不允许有两个人有同样的地址,地址可以是一个街道地址(Street-address),也可以是一个电子地址(Electronic-address)。一本有两个作者的书可以编码为:</P>
            <P></P>
            <P></P>
            <P>Example 22</P>
            <P><BR>&lt;e:Book xmlns:e="http://example.org/2001/06/books" &gt; 
            &lt;title&gt;My Life and Work&lt;/title&gt; &lt;firstauthor 
            href="#Person-1"/&gt; &lt;secondauthor 
            href="#Person-2"/&gt;&lt;/e:Book&gt;&lt;e:Person 
            xmlns:e="http://example.org/2001/06/books" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Person-1" 
            &gt; &lt;name&gt;Henry Ford&lt;/name&gt; &lt;address 
            xsi:type="e:ElectronicAddressType"&gt; 
            &lt;email&gt;mailto:henryford@hotmail.com&lt;/email&gt; 
            &lt;web&gt;http://www.henryford.com&lt;/web&gt; 
            &lt;/address&gt;&lt;/e:Person&gt;&lt;e:Person 
            xmlns:e="http://example.org/2001/06/books" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            id="Person-2"&gt; &lt;name&gt;Samuel Crowther&lt;/name&gt; 
            &lt;address xsi:type="e:StreetAddressType"&gt; &lt;street&gt;Martin 
            Luther King Rd&lt;/street&gt; &lt;city&gt;Raleigh&lt;/city&gt; 
            &lt;state&gt;North Carolina&lt;/state&gt; 
            &lt;/address&gt;&lt;/e:Person&gt;</P>
            <P><BR>Book with two authors having different addresses</P>
            <P><BR>编序也可以包含一些不在同一资源中的值的引用:</P>
            <P></P>
            <P></P>
            <P>Example 23</P>
            <P><BR>&lt;e:Book xmlns:e="http://example.org/2001/06/books" &gt; 
            &lt;title&gt;Paradise Lost&lt;/title&gt; &lt;firstAuthor 
            href="http://www.dartmouth.edu/~milton/" /&gt;&lt;/e:Book&gt;</P>
            <P><BR>Book with external references</P>
            <P><BR>同时下面是一个对上面结构的模式描述片段:</P>
            <P></P>
            <P></P>
            <P>Example 24</P>
            <P><BR>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:tns="http://example.org/2001/06/books" 
            targetNamespace="http://example.org/2001/06/books" &gt; 
            &lt;xs:element name="Book" type="tns:BookType" /&gt; 
            &lt;xs:complexType name="BookType" &gt; &lt;xs:annotation&gt; 
            &lt;xs:documentation&gt; &lt;info&gt; Either the following group 
            must occur or else the href attribute must appear, but not both. 
            &lt;/info&gt; &lt;/xs:documentation&gt; &lt;/xs:annotation&gt; 
            &lt;xs:sequence minOccurs="0" maxOccurs="1" &gt; &lt;xs:element 
            name="title" type="xs:string" /&gt; &lt;xs:element 
            name="firstAuthor" type="tns:PersonType" /&gt; &lt;xs:element 
            name="secondAuthor" type="tns:PersonType" /&gt; &lt;/xs:sequence&gt; 
            &lt;xs:attribute name="href" type="xs:anyURI" /&gt; &lt;xs:attribute 
            name="id" type="xs:ID" /&gt; &lt;xs:anyAttribute namespace="##other" 
            /&gt; &lt;/xs:complexType&gt; &lt;xs:element name="Person" 
            type="tns:PersonType" /&gt; &lt;xs:complexType name="PersonType" 
            &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt; &lt;info&gt; 
            Either the following group must occur or else the href attribute 
            must appear, but not both. &lt;/info&gt; &lt;/xs:documentation&gt; 
            &lt;/xs:annotation&gt; &lt;xs:sequence minOccurs="0" maxOccurs="1" 
            &gt; &lt;xs:element name="name" type="xs:string" /&gt; 
            &lt;xs:element name="address" type="tns:AddressType" /&gt; 
            &lt;/xs:sequence&gt; &lt;xs:attribute name="href" type="xs:anyURI" 
            /&gt; &lt;xs:attribute name="id" type="xs:ID" /&gt; 
            &lt;xs:anyAttribute namespace="##other" /&gt; 
            &lt;/xs:complexType&gt; &lt;xs:element name="Address" 
            base="tns:AddressType" /&gt; &lt;xs:complexType name="AddressType" 
            abstract="true" &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt; 
            &lt;info&gt; Either one of the following sequences must occur or 
            else the href attribute must appear, but not both. &lt;/info&gt; 
            &lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:choice&gt; 
            &lt;xs:sequence minOccurs="0" maxOccurs="1" &gt; &lt;xs:element 
            name="email" type="xs:string" /&gt; &lt;xs:element name="web" 
            type="xs:anyURI" /&gt; &lt;/xs:sequence&gt; &lt;xs:sequence 
            minOccurs='0' maxOccurs='1' &gt; &lt;xs:element name="street" 
            type="xs:string" /&gt; &lt;xs:element name="city" type="xs:string" 
            /&gt; &lt;xs:element name="state" type="xs:string"/&gt; 
            &lt;/xs:sequence&gt; &lt;/xs:choice&gt; &lt;xs:attribute name="href" 
            type="xs:anyURI"/&gt; &lt;xs:attribute name="id" type="xs:ID"/&gt; 
            &lt;xs:anyAttribute namespace="##other"/&gt; &lt;/xs:complexType&gt; 
            &lt;xs:complexType name="StreetAddressType"&gt; 
            &lt;xs:annotation&gt; &lt;xs:documentation&gt; &lt;info&gt; Either 
            the second sequence in the following group must occur or else the 
            href attribute must appear, but not both. &lt;/info&gt; 
            &lt;/xs:documentation&gt; &lt;/xs:annotation&gt; 
            &lt;xs:complexContent&gt; &lt;xs:restriction base="tns:AddressType" 
            &gt; &lt;xs:sequence&gt; &lt;xs:sequence minOccurs="0" maxOccurs="0" 
            &gt; &lt;xs:element name="email" type="xs:string" /&gt; 
            &lt;xs:element name="web" type="xs:anyURI" /&gt; 
            &lt;/xs:sequence&gt; &lt;xs:sequence minOccurs="0" maxOccurs="1"&gt; 
            &lt;xs:element name="street" type="xs:string" /&gt; &lt;xs:element 
            name="city" type="xs:string" /&gt; &lt;xs:element name="state" 
            type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:sequence&gt; 
            &lt;xs:attribute name="href" type="xs:anyURI"/&gt; &lt;xs:attribute 
            name="id" type="xs:ID"/&gt; &lt;xs:anyAttribute 
            namespace="##other"/&gt; &lt;/xs:restriction&gt; 
            &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; 
            &lt;xs:complexType name="ElectronicAddressType"&gt; 
            &lt;xs:annotation&gt; &lt;xs:documentation&gt; &lt;info&gt; Either 
            the first sequence in the following group must occur or else the 
            href attribute must appear, but not both. &lt;/info&gt; 
            &lt;/xs:documentation&gt; &lt;/xs:annotation&gt; 
            &lt;xs:complexContent&gt; &lt;xs:restriction base="tns:AddressType" 
            &gt; &lt;xs:sequence&gt; &lt;xs:sequence minOccurs="0" 
            maxOccurs="1"&gt; &lt;xs:element name="email" type="xs:string" /&gt; 
            &lt;xs:element name="web" type="xs:anyURI" /&gt; 
            &lt;/xs:sequence&gt; &lt;xs:sequence minOccurs="0" maxOccurs="0"&gt; 
            &lt;xs:element name="street" type="xs:string" /&gt; &lt;xs:element 
            name="city" type="xs:string" /&gt; &lt;xs:element name="state" 
            type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:sequence&gt; 
            &lt;xs:attribute name="href" type="xs:anyURI"/&gt; &lt;xs:attribute 
            name="id" type="xs:ID"/&gt; &lt;xs:anyAttribute 
            namespace="##other"/&gt; &lt;/xs:restriction&gt; 
            &lt;/xs:complexContent&gt; 
            &lt;/xs:complexType&gt;&lt;/xs:schema&gt;</P>
            <P><BR>Schema for example 22</P>
            <P><BR>5.4.2 数组</P>
            <P><BR>SOAP数组被定义为类型为“enc:Array”或类型源于“enc:Array”(可参阅 rule 
            8)。这种类型源于"enc:Array"的类型必须遵从"enc:Array"的限制,同时它可用于表示以下情况的类型定义,譬如整型数的数组或是一些用户自定义的枚举类型的数组等。数组被表示为对包含其的元素的名无特殊约束的元素值(就象值一般不会约束包含元素的名)。组成数组的元素可以是任意类型,包括嵌套的数组。</P>
            <P></P>
            <P>数组值的表示是一个该数组组成元素的一个有序序列。作为一个数组的值,元素名对于区分存取标识并非重要。元素可以有任意的名。实际上,这些元素的命名将按照模式中声明的建议,或由他们的类型所决定。就象在复合类型中通常情况下,如果数组中条目的值是单引用值,则该条目将包含它的值。否则,条目通过“href”属性引用它的值。</P>
            <P></P>
            <P>下面是一个模式的片段以及一个包含integer成员的数组:</P>
            <P></P>
            <P></P>
            <P>Example 25</P>
            <P><BR>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:enc="http://www.w3.org/2001/06/soap-encoding" &gt; 
            &lt;xs:import namespace="http://www.w3.org/2001/06/soap-encoding" 
            /&gt; &lt;xs:element name="myFavoriteNumbers" type="enc:Array" 
            /&gt;&lt;/xs:schema&gt;</P>
            <P><BR>Schema declaring an array of integers</P>
            <P><BR> </P>
            <P></P>
            <P></P>
            <P>Example 26</P>
            <P><BR>&lt;myFavoriteNumbers 
            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:enc="http://www.w3.org/2001/06/soap-encoding" 
            enc:arrayType="xs:int[2]" &gt; &lt;number&gt;3&lt;/number&gt; 
            &lt;number&gt;4&lt;/number&gt;&lt;/myFavoriteNumbers&gt;</P>
            <P><BR>Array conforming to the schema in Example 25</P>
            <P><BR>在这个例子中,“myFavoriteNumber”数组包含了几个成员,每个成员的值的类型都是xs:int。而类型是由enc:arrayType属性决定的。注意enc:Array的类型允许不严格的未修饰的元素名。这些名只传输了非类型的信息,因此在具体使用的时候,要么有一个xsi:type属性,要么包含它的元素要包含一个enc:arrayType属性。自然地,源于enc:Array的类型可以声明带类型信息的局部元素。</P>
            <P></P>
            <P>就象先前指出的,enc模式包含了一些元素名的声明,而这些名是对应于“XML Schema Part 2: 
            Datatypes”规范[11]中的每个简单类型的。这也包含一个“Array”的声明。使用这些定义,我们也许可以将显现先前的描述改写为:</P>
            <P></P>
            <P></P>
            <P>Example 27</P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -