I'm trying to load an XML file into an embedded database (SQLite) using .NET. The best way I've found to do this is to read the data into a DataTable/DataSet and then use a DataAdapter to Update that DataTable into the database table.
The problem is, the XML file I have to work with has data that isn't in the root node. There's the root node (tables), then a subnode (tableXXX) and all of the data is in the subnode.
When I use ReadXML (for the DataSet object), it simply reads in a single record (containing the name of the subnode table). I want to completely ignore the root node and treat the first subnode as if it is the root node.
How would I go about doing this?
(Or, if there's an easier way to load an XML file to a database, I'd be interested in hearing that as well, although I'm guessing I'll still need to work around this root node issue).
WATYF
EDIT
XDocument
is inSystem.Xml.Linq
namespacethe code can be as
ds.ReadXml(XDocument.Parse(xml).Root.Elements().First().CreateReader());