C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » XML »

Xml With C#


Posted Date: 19 Aug 2009    Resource Type: Code Snippets    Category: XML
Author: PadmababuMember Level: Bronze    
Rating: 1 out of 5Points: 7



Description :


This Example is used to get the Child of the RootNode with the InnerText Value


IDictionary iDic = new Dictionary();
XmlDocument m_Doc = new XmlDocument();

public List> GetSubSystemFromXML(string FileName)
{
List> arrLstChildNodes = new List>();
try
{
m_Doc.Load(FileName.Trim());
XmlElement root = m_Doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes)
{
IDictionary iDic = new Dictionary();
foreach (XmlNode ChildNode in node.ChildNodes)
{
iDic.Add(ChildNode.Name, ChildNode.InnerText);
}
if (iDic != null)
arrLstChildNodes.Add(iDic);
}
return arrLstChildNodes;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return arrLstChildNodes;
}



Responses

Author: Veerabagu    24 Aug 2009Member Level: Gold   Points : 0
Nice code snippet :)
keep rocking

Regards
Veera


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
XmlWithC#  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Export to xml from listview Control.
Previous Resource: Serialize XML object
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use