I'm building an application framework that does exactly what you're trying to do. The application configuration is kept in an XML file, the framework loads a DOM representation into memory, and then various components of the app can use functions of the app class to go get the config values they need. Don't forget that once you have the tree in memory (there are a couple of simple apps on the web site that show you how do do this), you still have to navigate the tree to get at the values you need. This had some surprises for me; for example, all the white space (I use a lot of \n and \t and spaces in my XML files to enhance readibility) becomes a node, even if it is not encased in XML elements, and that was not documented. Look at the API documentation on the web site. I have found it to be very good. In particular, for navigation, go look at the DOMNode class. Most all the classes you will be using for a fairly simple, read- only application are derived from it.
Good luck! anw > -----Original Message----- > From: Jesse Pelton [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 8:07 AM > To: '[EMAIL PROTECTED]' > Subject: RE: Using XML-File as config for a win32-prog (Parsing in C++) > > > Before you get too far, consider whether building a DOM is the > best approach > for your needs. For many applications, SAX is more appropriate. DOM is > useful if you want to manipulate a tree of nodes, but requires that you 1) > keep the tree around as long as you want to work on it and 2) > understand how > to navigate the tree. SAX is useful if you want to build your own > representation of the data as the document is parsed. It doesn't > create any > representation on its own. I tend to use SAX for parsing > documents and DOM > for building them. > > http://xml.apache.org/xerces-c/program.html has sections on both DOM and > SAX. > > I hope your "tight schedule" allows adequate time for you to > understand the > APIs you need to use, or your project may be doomed from the outset. > > > -----Original Message----- > > From: Thomas Porschberg [mailto:[EMAIL PROTECTED] > > Sent: Thursday, September 25, 2003 6:49 AM > > To: [EMAIL PROTECTED] > > Subject: Re: Using XML-File as config for a win32-prog > > (Parsing in C++) > > > > > > I'm myself a newbie but maybe DOMCount example is more > > suitable for you ?! > > > > thomas > > On Thu, Sep 25, 2003 at 12:00:33PM +0200, Oliver Keineke wrote: > > > I have to write a program that can be used as shell-replacement on > > > NT/2k-machines... is intended to be able to start and > > monitor different applications > > > on customer PCs. > > > An XML-File is used for configuration.... I have to use > > Xerces 1.7.0 and C++ > > > Builder 5. > > > > > > I'm struggling how to parse the file and extract the needed > > information. > > > As I'm on tight schedule and also have to sort out how to > > programm the > > > Win32-part of my programm, any help would be appreciated. > > > > > > After some struggling I managed to use the DOMPrint-Example > > but I still > > > don't know how to use the parsed XML-File > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
