Hello,
My program is being sent a large XML file, anywhere between 500k - 1MB. Of
the entire file, I need to allow a user to view/edit approximately 5% of it.
To make matters a bit more complicated, there are occasions where the program
needs to load up around 5 instances of these documents. I'm trying to find
the most efficient and non-complicated way to do this.
My initial idea was to load the XML file into a DOM and get/set the element
values via a dom. This is trivial to do, however the problem with this is
each 500k instance of this document consumes ~3MB of memory.
I started looking into is creating an object model and populating it using
an XPathReader. Oleg Tkachenko posted a message to this group 11/24/2004
(XPath and Serialization) mentioning how to load an object using
serialization via an XML Fragment and posted a link to a GotDotNet
XPathReader workspace (below).
Using a XmlTextReader / XPathTextReader for getting the XML into the object
model seems possible. Once the user has updated all the data, how do I go
about writing the data back into the XML document? Do I use a XmlTextWriter
and output each value to the correct spot in the outgoing document?
Also, our object model will not be structured identically to the XML
document. For example, the root object ("Person") may span multiple nodes
within the XML. From my understanding, XmlTextReader/Writer are forward-only
type of objects, which would complicate serializing/deserializing the object
model.
Which approach would work the best f, sticking with the XmlDocument or
looking into object model serialization/deserialization using
XmlTextReader/Writer objects?
Thanks!
Damon Allison
GotDotNet - XPathReader
http://www.gotdotnet.com/Workspaces/...0-10351156f2eb