共用方式為


Union Element Binding Support

The .NET Framework does not provide binding support for the <union> element.

When Xsd.exe encounters a simple type defined by union, it ignores the <simpleType> definition and uses the built-in string data type in its place.

Explanation

The XML Schema definition language allows a simple type to be defined as a union of one or more simple types, or member types. An instance of the type may validly conform to any one of the member types.

When the Xsd.exe utility encounters a simple type defined by union, it ignores the <simpleType> definition and uses the built-in string data type in its place. Accordingly, when deserializing an XML document into a type generated by Xsd.exe, the XmlSerializer class disregards an Xsi:type Attribute Binding Support attribute intended to instantiate a union, deserializing instead a string.

Possible Attributes Binding Support

id

The Xsd.exe utility ignores the id attribute, which is intended to provide a unique identifier.

memberTypes

Xsd.exe ignores the memberTypes value along with the rest of the containing <union> element. Instead, the tool produces a string in place of the simple type definition.

Possible parent elements: <simpleType>

Possible child elements: <annotation>, <simpleType>

See Also

Reference

XmlSchemaSimpleTypeUnion