473,240 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

random access to elements of a disk-based XML file


I am building a WinForms app that uses Web Services access to a server for
most of its data input/output, but I also need to persist some of its data
to the local disk (basically as a cache of some of the Web Services data) in
XML format.

Since the size of the XML local store could be rather large, I'd prefer to
have a random access mechanism for reading and writing to it. It seems that
XMLReader /XMLWriter are sequentially fast, but have no facility for random
access. XMLDocument can do random access, but only via a complete in-memory
copy of the data that I hold on disk. Correct?

Is there a truly random access alternative, for reading/writing individual
elements (or branches) of an XML file?

Thanks,

-- Bruce
Mar 15 '06 #1
3 2986
Bruce <co*********@newsgroup.nospam> wrote:
I am building a WinForms app that uses Web Services access to a server for
most of its data input/output, but I also need to persist some of its data
to the local disk (basically as a cache of some of the Web Services data) in
XML format.

Since the size of the XML local store could be rather large, I'd prefer to
have a random access mechanism for reading and writing to it. It seems that
XMLReader /XMLWriter are sequentially fast, but have no facility for random
access. XMLDocument can do random access, but only via a complete in-memory
copy of the data that I hold on disk. Correct?
Yes.
Is there a truly random access alternative, for reading/writing individual
elements (or branches) of an XML file?


No. You'd need to keep some kind of index of where each element
started, then seek to that location to read it. Unfortunately, with
buffering etc, keeping that index isn't terribly easy.

Have you considered transforming your data into something less
freeform, like a fixed length record format?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 15 '06 #2
Jon ,

Thanks for the answers.

Yes, I may have to consider a non_XML, fixed-length alternative. But first,
I'll probably try using the XMLDocument approach and see how "costly" it is
to read/write the entire file on each access.

Thanks,
Bruce

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Bruce <co*********@newsgroup.nospam> wrote:
I am building a WinForms app that uses Web Services access to a server
for
most of its data input/output, but I also need to persist some of its
data
to the local disk (basically as a cache of some of the Web Services data)
in
XML format.

Since the size of the XML local store could be rather large, I'd prefer
to
have a random access mechanism for reading and writing to it. It seems
that
XMLReader /XMLWriter are sequentially fast, but have no facility for
random
access. XMLDocument can do random access, but only via a complete
in-memory
copy of the data that I hold on disk. Correct?


Yes.
Is there a truly random access alternative, for reading/writing
individual
elements (or branches) of an XML file?


No. You'd need to keep some kind of index of where each element
started, then seek to that location to read it. Unfortunately, with
buffering etc, keeping that index isn't terribly easy.

Have you considered transforming your data into something less
freeform, like a fixed length record format?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Mar 15 '06 #3
Hi Bruce,

Did Jon's suggestion help you?
If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Keith Griffiths | last post by:
I'm trying to do a search under a set criteria followed by a selection of random entries meeting this criteria. But I don't seem to be able to achieve this. The idea being to search on say...
11
by: Dr John Stockton | last post by:
Q1 : Given an array such as might have been generated by var A = is there a highly effective way of reducing it to - i.e. removing the undefineds and shifting the rest down? ...
1
by: jprunier | last post by:
Hi I isolated this code which gives me odd results and I am not sure to understand why. Basically I declared "positions" as a map that I am using to store pairs of integers. The key used for the...
2
by: vsgdp | last post by:
From what I learned, if you want to do random element insertions and deletions you should use a list. But, with std::vector, if the order of the elements does not matter, couldn't you efficiently...
3
by: Phil Sherman | last post by:
What is the relationship between the snapshot elements: Log pages written Number write log IOs Number partial page log IOs There doesn't appear to be any information in my PDF System monitor...
5
by: jar13861 | last post by:
I'm confused on how to write a random array that will only generate 9 different numbers from 1-9. Here is what I have, but its only writing one number.... holder = new Array ( 9 ); var flag =...
13
by: porterboy76 | last post by:
If you only use a 32 bit seed for a random number generator, does that mean you can only ever produce a maximum of 2^32 (approx 4 billion) different sequences? What about the Mersenne Twister,...
9
by: Tuxedo | last post by:
I'd like to reorganize the third, fourth, fifth and sixth, as well as any elements thereafter in an array in random order: var a = new...
15
by: caca | last post by:
Hello, This is a question for the best method (in terms of performance only) to choose a random element from a list among those that satisfy a certain property. This is the setting: I need to...
36
by: Peter Olcott | last post by:
So far the only way that I found to do this was by making a single global instance of the container class and providing access to the contained class, through this single global instance. Are...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.