At 1:39 PM -0500 2/8/06, Kevin Windham wrote:
I have some code that reads and writes my preferences to an XML file. The writing code is pretty straight forward. It just travels down the chain of classes that make up the data model for my prefs and asks each class instance to add it's properties to the xml document.

The reading code however is somewhat inelegant it seems. I am using an XMLReader to parse the prefs file and it gives events for the xml entities as it reads them in. So in order to let each class instance handle it's own stuff, I have the XMLReader instance pass those events to methods in the various prefs classes that mirror the event in the XMLReader. Then each pref class has to determine if the current xml entity belongs to it, or to a class it contains. If it is a class contained in the current class, then the original event is passed on to the contained class, and the cycle continues down the chain. The code works fine, but it seems inelegant to be duplicating all those event methods in each class. My instinct tells me that there is a better way to handle this, but I haven't come up with it yet.

Does anyone have any suggestions?



I use the pbsw XML wrappers.

http://pbsw-code.net/code/realbasic/classes/pbsw-PropertyList/

I like them.
--

Cheers,

Dr Gerard Hammond
MacSOS Solutions
http://www.macsos.com.au
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to