开发者

Difference between a named Complex Type and an anonymous Complex Type in an Element

What is the difference between...

<xsd:element name=”add”>
<xsd:complexType>
    <xsd:sequence>
        <xsd:element name="x" type="xsd:float"/>
        <xsd:element name="y" type="xsd:float"/>
    </xsd:sequence>
</xsd:complexType>
</xsd:element>

and...

<xsd:complexType name=”ad开发者_如何学编程d”>
    <xsd:sequence>
        <xsd:element name="x" type="xsd:float"/>
        <xsd:element name="y" type="xsd:float"/>
    </xsd:sequence>
</xsd:complexType>

Both would appear as:

<add>
    <x type="xsd:float">1.00</x>
    <y type="xsd:float">2.00</x>
</add>

In the SOAP envelope...so is there any definitive difference between the two definitions?


Defining an element that refers to a named complex type by name has exactly the same effect as putting the complex type inline within the element declaration - except that a named complex type can be re-used, for example in different element declarations or in other complex types derived by restriction or extension.


Hi you should use element type if this document appear as root element in your SOAP envelope, and complexType type can't appear as root element they normally appear in child elements/not in root element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜