Selected Dataset Readxml

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.
 
A

Alberto Poblacion

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top