XML files and DataSets

ultraman

Well-known member
Joined
Dec 31, 1969
Messages
138
Location
Quebec, Canada
Hi ! I want to use an XML files as ressources files (kinda) to store all the error messages of my windows app. Is there a way to get only one record at a time from the XML file (like a Where clause in SQL) or do I have to load the file in a dataset so I can search through it ?

Because I think its a waste of mem space to keep a DataSet filled wih all the error codes at all times....

Or if you have a better way to do this, Im open to all kind of suggestions.

Thanks in advance !
 
You can iterate over each of the XMLNodes of an XMLDocument or you can get to a node directly via XMLDocument.SelectSingleNode().
 
For JABEs suggestion to work, youd have to load the whole XML file into memory.

The SAX objects may work, though Ive never used them. They are made to read in XML asynchronously, so that you only process a node at a time. Never tried it though...

Are these app-specific error messages and youre just looking for a way to keep them extracted from the main project? Even a medium sized lookup shouldnt be more than a thousand or so messages. If each message is 100 characters thats only 100k or so (plus baggage for the XML object itself) - maybe a meg on the outside. Given the requirements for .NET itself, I wouldnt think keeping a few of these system type lookups in memory would hurt performance too much.

-Ner
 
Are these app-specific error messages and youre just looking for a way to keep them extracted from the main project?

Yes, exactly.

So Ill just read it in the Main and keep a DataSet open.

Its faster to access then since my DataSet has a primarey key so I can access a line directly with the Find method.

Thanks a lot guys !
 
Back
Top