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 name="Column03" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column04" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column05" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column06" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column07" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column08" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column09" type="ColumnType" minOccurs="0"/>
   <xs:element name="Column10" type="ColumnType" minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="RowNumber" type="xs:integer"
    use="optional"/>
</xs:complexType>

You can examine the full schema for this in SimpleCSV6.xsd.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset