Mapping XML element and attribute data to relational table fields is a fairly common task in the world of ecommerce and there are many different mapping products available. In cases where a custom solution must be developed there are different routes that can be taken. One popular route is the Extensible Stylesheet Language Templates (XSLT) language, which can transform XML data into a structure that is compatible with one or more database tables. You can find a code sample that uses this technique to migrate a Yahoo!Store XML document into a database here.
In addition to XSLT, there are several other XML document parsing and database specific techniques that can be used to migrate XML data into a database. Rather than focusing on these solutions, this example demonstrates how native ADO.NET classes such as SqlDataAdapter and DataSet can be used along with the DataTableMapping and DataColumnMapping classes to map XML data to relational database table fields with a minimal amount of work.
|