PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
What should I use : XMLDocument or Custom tree like data structure ?
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
What should I use : XMLDocument or Custom tree like data structure ?
![]() |
What should I use : XMLDocument or Custom tree like data structure ? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
There's little point in re-inventing the wheel. XML is extremely flexible
and you can write a schema to enforce the data structure and to help validate the data itself, which can save you a huge amount of development time. In addition, the .NET framework contains many pre-written (and pre-tested) classes to manipulate XML, and not just as an in-memory DOM tree. You can treat XML recursively, as with other tree structures. Finally, XML and relational data are nearly interchangable via DataSets, which would make it extremely easy to store the node data in a database, should you need that capability. I'd recommend using XML. "Sasha" <no@no.com> wrote in message news:egYWK8TfDHA.2356@TK2MSFTNGP12.phx.gbl... > Hi everyone, > > I would like to hear your opinions about a design solution I am > contemplating. > > The problem I am following: Write an editor for a data structure that is > recursive in nature. In other words it is a tree, where child nodes can > contain links to parent nodes. And there multiple kind of nodes: Here is an > example > > Track 1 > Track 2 > Track 3 > Requirements > Requirement > Note > Requirements > Requirement > Note > Track 2 (reference) > Requirement > Requirements > Requirement > Note > Track 1 (reference) > Requirement > Note > Blah: > And so on : > > The order of the elements is important. So, I need an easy way to swap some > elements for example. > The data structure will be read from and saved to XML file. > > Here is my question: Should try to implement my own tree like structure or > should I use XMLDocument and manipulate the data in the inmemory DOM tree? > (Engine Class Collection pattern? ) > > What are you ideas on this? > > I appreciate your input. Thank you in advance. > > Sasha > > > > > > > > |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi everyone,
I would like to hear your opinions about a design solution I am contemplating. The problem I am following: Write an editor for a data structure that is recursive in nature. In other words it is a tree, where child nodes can contain links to parent nodes. And there multiple kind of nodes: Here is an example Track 1 Track 2 Track 3 Requirements Requirement Note Requirements Requirement Note Track 2 (reference) Requirement Requirements Requirement Note Track 1 (reference) Requirement Note Blah: And so on : The order of the elements is important. So, I need an easy way to swap some elements for example. The data structure will be read from and saved to XML file. Here is my question: Should try to implement my own tree like structure or should I use XMLDocument and manipulate the data in the inmemory DOM tree? (Engine Class Collection pattern? ) What are you ideas on this? I appreciate your input. Thank you in advance. Sasha |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Sasha wrote:
> Here is my question: Should try to implement my own tree like structure or > should I use XMLDocument and manipulate the data in the inmemory DOM tree? > (Engine Class Collection pattern? ) Depends on how your structure differ from XML and how you are going to use it. The simplest way is XmlDocument, but it can limit you if you need more than XML supports. Also if your structure is much simpler than XML, implementing custom tree could benefit in memory and speed too. -- Oleg Tkachenko http://www.tkachenko.com/blog Multiconn Technologies, Israel |
|
|
|
#4 |
|
Guest
Posts: n/a
|
"Sasha" <no@no.com> wrote in message
news:egYWK8TfDHA.2356@TK2MSFTNGP12.phx.gbl... > Hi everyone, > > I would like to hear your opinions about a design solution I am > contemplating. > > The problem I am following: Write an editor for a data structure that is > recursive in nature. In other words it is a tree, where child nodes can > contain links to parent nodes. And there multiple kind of nodes: Here is an > example .... Do you do anything with the data? IF you do, forget the XML dom part. Make classes, use XmlSerializer to reconstruct a class hierarchy from the XML data (and to save the data out into a XML file). I am doing a very complex editor for an O/R mapping framework at the moment - tons of editor controls. It would have been impossible (as in: a LOT more code) to do all this on top of a DOM model, which is just too stupid internally. I use XML as data structure externally, using XmlSerializer to construct the classes. Works like a charm. -- Regards Thomas Tomiczek THONA Software & Consulting Ltd. (Microsoft MVP C#/.NET) |
|
|
|
#5 |
|
Guest
Posts: n/a
|
I agree with you. And that is the path I will follow. I don't know if I can
use XmlSerializer with recursive data structures; I am afraid I will have to do it manually, which is not a big deal. But otherwise custom object is the way go. Thank you for your reply "Thomas Tomicek [MVP]" <t.tomiczek@thona-consulting.com> wrote in message news:OKPLP2UfDHA.1712@TK2MSFTNGP11.phx.gbl... > "Sasha" <no@no.com> wrote in message > news:egYWK8TfDHA.2356@TK2MSFTNGP12.phx.gbl... > > Hi everyone, > > > > I would like to hear your opinions about a design solution I am > > contemplating. > > > > The problem I am following: Write an editor for a data structure that is > > recursive in nature. In other words it is a tree, where child nodes can > > contain links to parent nodes. And there multiple kind of nodes: Here is > an > > example > ... > > > Do you do anything with the data? > > IF you do, forget the XML dom part. > > Make classes, use XmlSerializer to reconstruct a class hierarchy from the > XML data (and to save the data out into a XML file). > > I am doing a very complex editor for an O/R mapping framework at the > moment - tons of editor controls. It would have been impossible (as in: a > LOT more code) to do all this on top of a DOM model, which is just too > stupid internally. > > I use XML as data structure externally, using XmlSerializer to construct the > classes. Works like a charm. > > -- > Regards > > Thomas Tomiczek > THONA Software & Consulting Ltd. > (Microsoft MVP C#/.NET) > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

