Hi,
I am using the control Infragistics.Win.UltraWinTree.UltraTree to display xml nodes in to the GUI.and using object of the class Infragistics.Win.UltraWinTree.UltraTreeNode to add child nodes and siblings their parent nodes to display into GUI.
I am using object of the class System.xml.XmlDocument to load XML file.
If data(properties) of particular node will be storing into structure array for later point of use. For example : Element properties: Name, Type, MatchCreterion, DataStruct, Mandatory, Return are storing into structure object array. and will use laterEg: <ElementList> <Element> <Name>MSC</Name> <Type>String</Type> <MatchCreterion>Prefix</MatchCreterion> <DataStruct /> <Mandatory>True</Mandatory> <Return>Yes</Return> </Element> <Element> <Name>SME</Name> <Type>String</Type> <MatchCreterion>Prefix</MatchCreterion> <DataStruct /> <Mandatory>True</Mandatory> <Return>Yes</Return> </Element> </ElementList>Using for loop to add child nodes to their parent node. (Creating TreeNode objects and adding into their parent nodes).
Issue is Here:
If I am trying to load 10 MB xml file, it is taking 20 minutes time to load that file and CPU usage 100% for loading that file. After that system is becoming very slow.
Please provide the solution.
Its very important for my application.
Thank you for your time.
RegardsPrathap Reddy U
Looping through every element of a 10 MB xml file is probably going to take some time, with or without using the UltraWinTree. are you sure it's the tree that's causing the delay?
The only thing you could do to make the tree a bit faster would be to turn off the painting of the control while it loads. You do this using the BeginUpdate and EndUpdate methods.
Also, make sure you have the latest Hot Fix for the controls. We recently made an update to the tree so that BeginUpdate and EndUpdate will be even more efficient. I'm not sure if that update is in the latest hot fix, but if not, it should be in the next one.
As per my observation it's the tree that's causing the delay? I tried using BeginUpdate and EndUpdate methods. But No use. We are using Infragistics 5.2. We have no latest version of infragistics. You are saying that latest Hot Fix for the controls will be efficient to form trees. Are you sure latest version solves my problem. If we purchase latest version and if it does not solve my problem then purchase laetset version does not make sense. Please give any idea.
Regards
Prathap
Hi Mike,
Thank you very much for your reply. I will install trail version and test the same. I will reply back to you if i get any issue while working on it.
Thanks and Regards
New UltraTreeControl does bot help me to resolve performance issue. Can you please give any idea to resolve my performance issue?
Hi Prathap,
In that case, we will need you to provide a small sample project demonstrating the performance issue so we can determine the cause.
Thank you for your reply.
Could you please provide any sample project demonstrating the performance?
One more question is it possible to display processed data into UltraTree control while processing large XML(Using Threads). So End user can able to navigate between GUI screens until the whole file is processed.
Example: Open 50 MB XML file from Browser. End user can able to move up and down while it is processing/loading.
Prathap.
Hi Prathap.
prathap_u said:Could you please provide any sample project demonstrating the performance?
I really don't see how I could provide you with any useful sample of this, since I cannot anticipate the needs of your application. If you can duplicate a performance problem in a small sample project, I'd be happy to take a look at it. But other than the existing samples, I'm afraid I can't write a custom sample to demonstrate how to avoid an issue whose cause is unknown.
prathap_u said:One more question is it possible to display processed data into UltraTree control while processing large XML(Using Threads). So End user can able to navigate between GUI screens until the whole file is processed.
This might be possible, but it's extremely dangerous and I would not recommend it. Using threads to load data is very complex and difficult and if you do not marshal the data properly in every case, you could end up with random crashes in your application that are very difficult if not impossible to debug.
prathap_u said:1) Can we edit the cell (UltaTree Control)?
Yes, you need to set the CellClickAction (on the Override) and also AllowCellEdit to enable editing.
prathap_u said:2) Can we populate dynamic values(ComboBox) some of cells in a row (UltaTree Control)?
I'm not exactly sure what you mean by "dynamic", but the column has a ValueList property whcih you can use to provide a dropdown list in a cell.
prathap_u said:2) Can we delete the row/rows(UltaTree Control)?
There's an AllowDelete property on the Overrride, just like AllowCellEdit.
prathap_u said:3) Can we copy and paste the multiple rows(UltaTree Control)?
There is no built-in copy and paste support for nodes in the tree.
You might want to consider using UltraWinGrid instead of UltraWinTree. The grid has support for everything you asked about here, including copy and paste.
I followed one approach to load large XML in very less time.
Converted Large XML into DataSet and binded to UltraTree control. It took very less time to load and display in tabular format(GridView). The attahced JPG file shows the sample view.
I have some queries if choose to use latest version of infragistics controls. The following queries are in the Grid View of UltraTree Control. Can you please reply?
1) Can we edit the cell (UltaTree Control)?
2) Can we populate dynamic values(ComboBox) some of cells in a row (UltaTree Control)?
2) Can we delete the row/rows(UltaTree Control)?
3) Can we copy and paste the multiple rows(UltaTree Control)?
Thank you for your time?
As I said above, the vast majority of the performance issue here appears to be caused by the accessing of the data from the XML document and has nothing to do with adding the nodes to the tree.
I'm not really an expert on reading data from an XML Document in the most efficient way, so I'm afraid I can't help you much there. Perhaps you could post on a more general DotNet programming or Microsoft forum where you could get some better advice.
As far as the Tree control is concerned, there's no built-in functionality to read XML data into the tree. You have to add the nodes manually or bind the tree to a DataSource.
As per my knowledge adding XML nodes into UltraTree is using for loop. Do you have any other ides to populate XML nodes into UltraTree Control and Do you have any example to load any XML file into UltraWinTree. The look and feel is as Tree structure which i shown in my given example.
Note: The XML file size is not constant. some times file size may be 1GB.
I took a look at your sample and I don't see anything obviously inefficient here as far as the tree is concerned.
However, there are a couple of interesting things I found.
First, you are displaying the elapsed time in minutes. This did not work for me and always returned a 0, because the loading of the data always took less than a minute. I changed it to display the seconds, instead, and every time I run the app, it takes about 30 seconds. So perhaps this is just a difference in the speed of our machines.
The next thing I did was tried to determine how much of the time is taken up by adding nodes to the tree and how much is just walking the XML document. So to test that, I removed the tree from the project and even removed the reference to the WinTree assembly. I deleted all of the code that was referencing the tree or tree nodes.
The results were quite surprising. Without the tree, the code actually takes longer to run. The time jumped up to 40 seconds. I have no idea why this is the case, but it seems to me that the overwhelming majority of the time taken to load the data has is the XML Document code and has nothing to do with the WinTree.