[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

is there a way to display a large xml file of bookmark/link format in a menu structure in a C# windows application?

Posted on 2010-09-20
7
Medium Priority
?
533 Views
Last Modified: 2013-12-16
the issue is the following:  i'm trying to display a catalog of bookmarks maintained in an XML file.  on application load, the xml file is read and parsed into a mirrored structure of ToolStripMenuItems (folders and links).  a recursive function is used to traverse the file, as is customary for navigating tree structures, and the file loads fine when it is small.  However, both the time required to execute the recursion and the memory required to hold all of the objects becomes absurdly large (12MB xml file = 10-15seconds to load/traverse = 750MB-1.5GB of memory depending on OS and system RAM).  In .net / web world, I would be able to set the datasource for the menu structure to the xml file and let it manage/run that way, but that functionality does not seem to exist in the client-side windows app.  
does anyone have any insight into a way to handle a large bookmark file or bind a large xml-based menu structure in a windows C# application?
0
Comment
Question by:xyntekinc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 33721969
Well, this is not a trivial task, but the answer is: lazy binding.
You should not load all the xml into memory. What you need is some kind of in-memory indexing.

I would assume you will show the information in a tree-like fashion, so you can load just the information which is visible.
This way: You don't spend time loading ALL the xml into memory in-advance, but few milliseconds to load what is visible every time you open a tree leaf.

Does it sound like a good start?
0
 

Author Comment

by:xyntekinc
ID: 33722329
it does, and that was actually a tentative plan, but i was not sure exactly how to go about tracking the up-and-down levels and building at run-time.  also,  i was really hoping for a way to "bind" the xml to a menu instead of creating new (bloated) menuitem objects for every single link.  should i pursue the lazy binding / dynamic-loading plan, 2 questions: 1) what type of performance hit can i expect and 2) what is the best/fastest way to maintain, index, and load the xml doc?  i suppose i could store the doc in memory so the 12MB disk-read is not necessary on every click.  the potential issue i saw was handling the mouse-over events of the folder nodes without disrupting the view/UI of the menu structure.  i'm not looking for code, just suggestions or best practices.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 33722424
have a question: how many items has your 12Mb xml?
sounds like it is too much information for a menu.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:xyntekinc
ID: 33727482
i'm not sure exactly how many, but i'd say somewhere in the hundreds... 200ish probably.  I agree that it is much more than a menu is designed to hold (especially given the amount of memory each menuitem requires), but what other ways are there to maintain that tree-like menu structure in a GUI?  the contents of the bookmarks/link menus are the bread-and-butter of the application.  it worked in previous versions of the application built in C++ (.net 2005 i believe), as the objects were substantially smaller in memory.
unless there is another similar structure or object that will allow an xml doc to bind to it, i think the lazy/dynamic binding is a viable alternative if the event-handling can be handled in the background without drastically degrading the user-experience.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 900 total points
ID: 33731616
I would suggest to use a regular treeview object. You can style it to look like a menu (gray background, highlighted in blue, etc)
there are many examples of "lazy load" for treeviews. Here is some article about WPF treeview, but concept can be applied to winforms as well:
http://www.codeproject.com/KB/WPF/TuningTheTreeView_1.aspx
0
 

Author Comment

by:xyntekinc
ID: 33843051
i have yet to give the lazy-load a try.  that seems like the best alternative, short of integrating a web-component into the application and attempting to use the treeview menu structure with datasource that way.
0
 

Author Closing Comment

by:xyntekinc
ID: 34066257
using WPF treeview works the best, and lazy-load was not needed.  the solution would have worked but was overly complex.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question