But it doesn't imply you should keep the state in the data model. I don't know what the xml describes - does it describe items that are to be visualized using a tree view?
With the model there is really no concept of "creating" items. They are just there... When you load data from the file, you can build a separate data structure that will serve only as a means to expand the tree. Then you'll just iterate the structure and expand appropriate items.The only "disadvantage" I see now is that the iteration must be done after the items were created, instead of when they are created (I see this as a second strep, re-iterating through the elements)...
Keep in mind that the model is only an interface to *any* data, nothing more, nothing less. If you have an XML file - don't read/parse/create structures. Just make your model operate on the XML directly. Otherwise you're ending up with an unnecessary redundancy and lag.
Bookmarks