Share via


Xsi:type Attribute Binding SupportĀ 

The .NET Framework provides partial binding support for the xsi:type attribute.

The XmlSerializer class uses the xsi:type attribute to determine what allowable type of object to deserialize from the XML instance element containing the attribute.

Explanation

The XmlSerializer class uses the xsi:type attribute to determine what type of object to deserialize from the XML instance element containing the attribute. The type must be present in the derivation hierarchy. (The prefix xsi is used for the XML Schema instance namespace, http://www.w3.org/2001/XMLSchema-instance and applies to XML instance documents intended to conform to specified XML schemas.)

The .NET Framework's XML serialization infrastructure does not support a binding for unions of simple types through the <union> element, instead binding a union simple type as a string. So while deserializing an XML instance document, XmlSerializer disregards an xsi:type attribute intended to instantiate a union, deserializing instead a string.

Possible containing elements: any instance element