C.8. Attributes

As defined in Inferring Tables, an element with attributes will be inferred as a table. The attributes of that element will then be inferred as columns for the table. The ColumnMapping property of the columns will be set to MappingType.Attribute, to ensure that the column names will be written as attributes if the schema is written back to XML. The values of the attributes are stored in a row in the table. For example, consider the following XML:

<DocumentElement>
  <Element1 attr1="value1" attr2="value2"/>
</DocumentElement>

The inference process will produce a table named “Element1” with two columns, “attr1” and “attr2.” The ColumnMapping property of both columns will be set to MappingType.Attribute.

DataSet: DocumentElement ...

Get Essential ADO.NET 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.