TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sergey K
NA
1
2.6k
Slow XML file parsing
Nov 10 2013 11:41 PM
I am using this structure to parse XML file ( ~2 Mb)
It takes about 5 minutes to create TreeView .. How to make it faster?
private void button1_Click(object sender, EventArgs e)
{
var doc = new XmlDocument();
doc.Load(@"filename");
treeView1.Nodes.Clear();
var rootNode = new TreeNode(doc.DocumentElement.Name);
treeView1.Nodes.Add(rootNode);
BuildNode(doc.DocumentElement, rootNode);
treeView1.ExpandAll();
}
private void BuildNode(XmlNode xmlNode, TreeNode node)
{
if (xmlNode.HasChildNodes)
{
foreach (XmlNode childNode in xmlNode.ChildNodes)
{
var treeNode = new TreeNode(childNode.Name);
node.Nodes.Add(treeNode);
BuildNode(childNode, treeNode);
}
}
else
{
node.Text = (xmlNode.OuterXml).Trim();
}
}
Reply
Answers (
0
)
How to Auto Calculated time in SQL Database Select Column
How to make menu bar with in the asp net