If you have a 1-1 mapping between an object and an XmlNode, then you are
storing behavior and data in different classes. It would be much neater to
store behvaior and data together. Therefore, you could create your own
specialized sub-types of TreeNode and XmlNode. This is very easy to do with
TreeNode.

Doing this with XmlNode becomes a bit more tricky, because System.Xml has an
XmlLoader class which knows how to pull elements out of an XmlReader and
instantiate XmlNode classes, populating the XmlDocument as it goes.
Injecting your own specialized sub-type of XmlNode would be impossible here.
Therefore, you would have to create your own XML Loader.

Finally, if you didn't gather, I'm a fan of events bubbling up the tree
hierarchy to the top.

Richard

> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED]]On Behalf Of Christian
> Schmitz
> Sent: 09 September 2002 07:58
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] event granularity
>
>
> Hi,
>
> I have a problem with the location of events in the .NET framework. Why
> Microsoft locates the events in top level classes and not in the classes
> where the events really happens? For instance: TreeView raises events, not
> the TreeNode or XMLDocument raises events not the XMLNode! I
> think, it is a
> bad concept to do it in this style.
> For example: If you have a large object model which holds it's data in an
> XMLDocument and every object is linked in a 1:1 relationship to a XMLNode-
> object how can I realize that the object "hears" what happens in its
> XMLNode? When I use the .NET style I would link every object to the
> XMLDocument and filter the suitable events. That means a tremendous
> overhead.
>
> Thanks for any reply!
> Christian
>
> You can read messages from the Advanced DOTNET archive,
> unsubscribe from Advanced DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to