O'Reilly logo

Essential ADO.NET by Bob Beauchemin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required