C.9. Elements without Attributes or Child Elements

If an element has no child elements or attributes, it will be inferred as a column. The ColumnMapping property of the column will be set to MappingType.Element. The text for child elements is stored in a row in the table. For example, consider the following XML:

<DocumentElement>
  <Element1>
    <ChildElement1>Text1</ChildElement1>
    <ChildElement2>Text2</ChildElement2>
  </Element1>
</DocumentElement>

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

DataSet: DocumentElement

Table: Element1

ChildElement1 ChildElement2
Text1 Text2

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.