Link to home
Start Free TrialLog in
Avatar of wannajmi
wannajmi

asked on

view tree structure/tree file format

Hi..
does anyone know how to view and manipulate a tree structure file using VB and what are the best tree file format available ?
Avatar of robertlees
robertlees

Without knowing the detail of what you are trying to achieve, this is what I would do...

You say 'tree structure file' - if you really mean file, rather than database, then let's say your file is a text file. I would have each record containing an ID, then its parent ID, then the main text of the item. Each of these would be separated by a delimiter that you wouldn't expect to find otherwise in the text. Say the Tab character. Then I would read through this file, splitting each record into its elements by searching for the Tab characters, then adding to a Tree Control. You can use the ID from each record as the key of the item in the Tree Control. Then the Parent ID from each record would allow it to be attached to its parent item in the Tree Control. Your VB app could allow items to be added, changed and deleted from the tree control. When you have finished, just re-open the file as Output (thereby deleting its previous contents) and dumping the Tree Control contents into the file.

Do you need more detail on how to populate the Tree Control ?
Avatar of wannajmi

ASKER

My data is about the phylogenetic tree (tree structure from different species) I need to record my data as a tree and open it to manipulate (edit, delete, added) the branches of the tree structure.
I would use XML as your way to store hierarchical data. It is easy to use/edit in VB, and very powerful. My company's application is based on a hierarchical data set (a 100,000+ item medical knowledge base), and we use XML for everything we do.

Your file may look like:

<tree>
  <phylus name="yyyy">
    <genus name="xxxx">
      <species name="zzzz" class="aaaa" commonName="abcde"/>  
      <species name="rrrr" class="bbbb" commonName="fghij"/>  
    </genus>
  <phylus>
</tree>

(I'm obviously not an expert), although you pretty much get to decide whatever structure & naming you want.
The advantages of using XML are:

1) Built-in tree libraries: include Microsoft XML in your project references (MSXMLx.DLL), and use the DomDocument object to load your file, and right away you have a hierarchical structure that you can access, modify and query.

2) The file is viewable as a tree in Internet Explorer (or any borwser), and you can show it in your app by using a WebBrowser control (if you have IE, you have this). Just add Microsoft Internet Controls to your components tab to get it.

3) Even though it's easy to implement, this approach has tremendous potential: for example, if you wanted to show your data (or part of it) in a different way, you can use XSLT to format your XML, or to create an HTML.

4) There are mountains of examples and documentation about XML and all you can do with it, as well as VB examples of how to use it in your apps.

Look at the left panel of this web site, with the various categories of questions: that panel is generated on the fly from an XML tree file that contains all the categories, and an XSLT to create the HTML you see.










ASKER CERTIFIED SOLUTION
Avatar of Shaka913
Shaka913

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial