ultraman Posted September 22, 2003 Posted September 22, 2003 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 it's 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, I'm open to all kind of suggestions. Thanks in advance ! Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
JABE Posted September 23, 2003 Posted September 23, 2003 You can iterate over each of the XMLNodes of an XMLDocument or you can get to a node directly via XMLDocument.SelectSingleNode(). Quote
*Experts* Nerseus Posted September 24, 2003 *Experts* Posted September 24, 2003 For JABE's suggestion to work, you'd have to load the whole XML file into memory. The SAX objects may work, though I've 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 you're just looking for a way to keep them extracted from the main project? Even a medium sized lookup shouldn't be more than a thousand or so messages. If each message is 100 characters that's only 100k or so (plus baggage for the XML object itself) - maybe a meg on the outside. Given the requirements for .NET itself, I wouldn't think keeping a few of these system type lookups in memory would hurt performance too much. -Ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
ultraman Posted September 24, 2003 Author Posted September 24, 2003 Are these app-specific error messages and you're just looking for a way to keep them extracted from the main project? Yes, exactly. So I'll just read it in the Main and keep a DataSet open. It's 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 ! Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.