Click here to Skip to main content
13,195,710 members (54,083 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 18:58pm
janadts386
Comments
Sanjay K. Gupta 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 4-Dec-12 6:13am
   
5+
Mika Wendelius 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 4-Dec-12 6:13am
   
5+
__TR__ 7-Dec-12 11:37am
   
Thanks.
Mika Wendelius 4-Dec-12 13:46pm
   
Good tutorial, 5.
__TR__ 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
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171019.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2017
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