The .NET platform offers several different avenues for
moving XML data into a database. For example, XML can be mapped to database
tables and fields using the DataTableMapping and DataColumnMapping
classes in conjunction with a DataAdapter, or the XML can be transformed
to fit the database schema using XSLT.
While both of these solutions work well, there may be
cases where you want complete control over the SQL statements that are
generated as well as optimal efficiency so that parsing large XML documents
does not represent a problem to your application.
This example examines how the XmlTextReader can be used
to parse a complex XML document hierarchy to dynamically generate SQL
statements that can be executed against a database. Because the XmlTextReader
is a stream, it allows very large XML documents to be parsed quickly and
efficiently.
|