Reading in parts of an XML DataSet

  • Thread starter Thread starter Mystery Man
  • Start date Start date
M

Mystery Man

Hi

I am experimenting with XML files that contain data sets created using
the WriteXML method available with the DataSet type.

Reading in the whole file is simple using the corresponding ReadXML
method. However, what I really want to do is simply read in the parts
of the file based on a very simple SELECT clause. I want to do this
because these files are quite large and (a) it is too slow (b) they
take up too much memory once loaded.

For example, if the dataset contained code/value pairs, can I somehow
get the code/value pairs if the code was greater than a particular
value.

I am unsure if XMLReader will do the trick?
 
Mystery Man,

An XmlReader is probably the best way to go. You would still have to
cycle through the whole XmlDocument, but I think that it is possible. You
would just pull tags until you know you have pulled the values you want, and
then dispose of the rest. It would be more efficient than loading the whole
document, but more work than it as well.

As for being selective about the results, you would have to code that as
well, pulling only the elements that you need.

Hope this helps.
 
Back
Top