Last post Jan 20, 2011 12:30 PM by Martin_Honnen
Jan 20, 2011 09:06 AM|NachoLibre|LINK
I have an xml doc I need to navigate through to check various values, then eventually write out to a SQL table (individual values, not as an xml doc). I see I can feed my xml doc to either an xmlnodereader or a dataset. Is there any reason to use one
over the other? The XML will already be validated btw. And the xmldoc doesn't correspond directly to an underlying sql table, only parts of it do.
Jan 20, 2011 09:58 AM|Martin_Honnen|LINK
Does "xmldoc" mean you already have a System.Xml.XmlDocument? If you want to navigate that to extract data then I wouldn't use an XmlNodeReader, I would simply use XPath and SelectNodes and SelectSingleNode to find the nodes you are interested in.
Jan 20, 2011 12:23 PM|NachoLibre|LINK
Ok, but what about the method you suggest versus zoinking it into a dataset and navigating through the data that way?
Jan 20, 2011 12:30 PM|Martin_Honnen|LINK
The XML formats a DataSet can handle are limited (e.g. <parent><child>foo 1</child><child>foo 2</child></parent> can't be handled). If you are more comfortable with DataSet/Tables than with XPath and your XML format can be handled by DataSet.ReadXml then
feel free to use that approach.