DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links