Fill a treeview from a file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Fill a treeview from a file

  1. #1
    Join Date
    Jan 2005
    Posts
    56

    Fill a treeview from a file

    I have a text file that looks like this:

    RootText
    {
    version
    some comments
    }
    {
    group1
    some text
    some text
    {
    subgroup1
    some text
    some text
    }
    some text
    }


    I would like to fill a treeview, using the brackets: an open brackets means we have child, a close brackets means "go back".

    RootText
    |
    - |->version
    - |->some comment
    - |
    - |->group 1
    - |->Some text
    - |->Some text
    ---|->Subgroup1
    ---|->Some text
    ---|->Some text
    - |->Some text



    The biggest problem is... it isn't defined how many subgroups there are. Is there an easy way to do this ?

  2. #2
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    I can think of a XML file, having these contents with tags instead of just braces. However if you cannot change your input file

    Consider replacing your { with <nodes><node> and } with <node></nodes> and every carriage return with </node><node> with a method and writing an output file before you bind to the treeview
    Just see how your file looks like then use a XSL file if required and transform them to the treeview. I know this will work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center