"Martin Honnen" <mahotrash@yahoo.dewrote in message
news:erugPY$vIHA.4912@TK2MSFTNGP03.phx.gbl...
Quote:
Brian Cryer wrote:
Quote:
>Currently I am using XmlReader (but I am open to other options) to parse
>an XML file, and I would like to be able to stop/break the current parse
>(simple enough) and then resume it later (say after a reboot). Is there
>any way to get the current location in the file that the XmlReader has
>reached so as to be able to restore that and start from that point later?
|
>
I don't think so. If you have an underlying stream you could store the
stream position but I don't know of any way to store and restore the state
of the XmlReader.
|
I'm not too worried about the "state" of the XmlReader (I might be when I
get there but for now I'm assuming if there are any issues that I'll be able
to work round them).
I've looked at storing the stream position, but its evident that the
XmlReader reads in a buffer load because my stream position is at about the
8KB mark when I get to the first tag in the XmlReader.
Ahh ... Martin, you've been a great "sounding board". Knowing that the
XmlReader doesn't provide any way of doing this is useful. But thinking
about it, if the XmlReader reads in 8KB chunks (an assumption on my part,
but one which I ought to be able to test) then as a way of "restoring" I may
be able to get away with simply putting my read point 8096 bytes before the
last known position in the underlying stream and then deal with any errors
that get thrown up when XmlReader hits what it thinks is malformed XML. Bit
yucky, but this might work for me (if XmlReader will play ball). At least it
gives me an avenue to explore.
TA.