Name

xsi:type

The xsi:type attribute lets you define the type of an element locally (in the document) rather than in the schema. As XML Schema Part 1: Structures puts it, “An element information item in an instance may, however, explicitly assert its type using the attribute xsi:type.”

The value of the xsi:type attribute must be a QName, identifying the type of the element. The type specified by xsi:type has to be a subtype of the type that was declared for the element originally. For the xsi:type declaration to work, a matching type must be defined in the schema the validator is using. Most typically, the xsi:type attribute is used to specify predefined types, but it isn’t limited to that.

Get XML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.