Selected Dataset Readxml

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have an xml file that can contain a lot of records and I am using
dataset.readxml to read in the file. When looking on what I do with those
records, I am interested only the most recent ones (the last few hundreds).
Unfortunately, the readxml loads the whole 10 000s of them. Is there a way
to specify the loading of the last few hundreds only?

Anthony.
 
ATT said:
I have an xml file that can contain a lot of records and I am using
dataset.readxml to read in the file. When looking on what I do with those
records, I am interested only the most recent ones (the last few
hundreds).
Unfortunately, the readxml loads the whole 10 000s of them. Is there a
way
to specify the loading of the last few hundreds only?

Instead of using ReadXml, you could use an XmlReader to read the nodes
sequentially, which is a very fast operation. Just ignore the nodes you want
to skip until you arrive at those that interest you. If their structure is
complex, instead of analyzing them with the XmlReader, you can dump their
content into a MemoryStream, and then use ReadXml to load the DataSet from
the MemoryStream.
 
Back
Top