Creating New Complex Types by Extension

One of the nicer features of schema language is the ability to create a new complex type by extending an existing one. The most frequent usage involves taking an existing sequence of Elements and adding a new one at the end. The example below defines RowType, followed by an extension where we add a new column for birth date. You can find the complete schema in SimpleCSV5.xsd.

Extending a Complex Type by Adding an Element in SimpleCSV5.xsd
 <xs:complexType name="RowType"> <xs:annotation> <xs:documentation>Here we give a named type to our Row Element, instead of defining it anonymously in-line. </xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="Column01" type="ColumnType" minOccurs="0"/> ...

Get Using XML with Legacy Business Applications 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.