Attribute Declarations

Elements with complex content can have Attributes in the same way that Elements with simple content can. If we wanted to add to our Row Element a RowNumber Attribute with the following format:

<Row RowNumber="2">

we could specify the Attribute in our RowType as shown below.

Specifying an Attribute on an Element with Complex Content in SimpleCSV6.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. We also have added a RowNumber Attribute. </xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="Column01" type="ColumnType" minOccurs="0"/> <xs:element name="Column02" type="ColumnType" minOccurs="0"/> <xs:element ...

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.