Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
hi
i have xml file in my D:drive i want retrive xml file into windows applications and filter the xml data,
how can do this
if u know plz help me.
Posted 3-Dec-12 19:58pm
janadts386
Comments
Sanjay K. Gupta at 6-Dec-12 1:18am
   
What you have tried so for?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Have a look at XmlDocument[^] and especially XmlDocument.Load[^] method.
  Permalink  
Comments
Mohamed Mitwalli at 4-Dec-12 6:13am
   
5+
Mika Wendelius at 4-Dec-12 13:46pm
   
Thanks :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Take a look at this article. It shows how to read and write XML documents in Microsoft .NET using C# language.
Reading and Writing XML in C#[^]
 
Good luck.
  Permalink  
Comments
Mohamed Mitwalli at 4-Dec-12 6:13am
   
5+
__TR__ at 7-Dec-12 11:37am
   
Thanks.
Mika Wendelius at 4-Dec-12 13:46pm
   
Good tutorial, 5.
__TR__ at 7-Dec-12 11:38am
   
Thanks.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Took this off : http://stackoverflow.com/questions/5604330/c-sharp-xml-parsing-read-a-simple-xml-file-and-retrieve-values[^]
 
View Link to read the sample xml, configure to code to suite your xml file
 
Read XML
public void Read(string  fileName)
    {
        XDocument doc = XDocument.Load(fileName);
 
        foreach (XElement el in doc.Root.Elements())
        {
            Console.WriteLine("{0} {1}", el.Name, el.Attribute("id").Value);
            Console.WriteLine("  Attributes:");
            foreach (XAttribute attr in el.Attributes())
                Console.WriteLine("    {0}", attr);
            Console.WriteLine("  Elements:");
 
            foreach (XElement element in el.Elements())
                Console.WriteLine("    {0}: {1}", element.Name, element.Value);
        }
    }
 

 

To Open XML File in Hard Disk:
 
static void Main()
    {
        var assembly = Assembly.GetExecutingAssembly();
        using (var stream = assembly.GetManifestResourceStream("ProjectName.test.xml"))
        using (var reader = new StreamReader(stream))
        {
            Console.WriteLine(reader.ReadToEnd());
        }
    }
 
Please vote if you found this usefull
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 235
1 DamithSL 225
2 OriginalGriff 198
3 George Jonsson 170
4 Maciej Los 165
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100