You must Sign In to post a response.
  • Category: WPF

    How to read xml file in WPF ?

    Are you looking for a way to read xml file in WPF ? then read this thread to know how to read it

    i have XML file and below is my Functionality in WPF

    1. read XML information
    2. display information in the textbox
    3. modify textbox value
    4. create new xml file with modified values
  • #755901
    You can read Xml file using following classes
    1. XMLReader
    2. XMLTextReader
    3. XmlDocument
    4. XPathNavigator
    XMLTextReader is good to read xml, see below link
    and to read xml using XMLDocuemnt see below link

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #755911
    You can use following command to read any XML file
    XmlTextReader textReader = new XmlTextReader("C:\\books.xml");
    XmlTextReader textReader = new XmlTextReader("C:\\books.xml");
    Code snippet for how to use above commands

    using System;
    using System.Xml;
    namespace ReadXml1
    class Class1
    static void Main(string[] args)
    XmlTextReader textReader = new XmlTextReader("C:\\books.xml");
    while (textReader.Read())
    Console.WriteLine("XmlTextReader Properties Test");
    Console.WriteLine("Name:" + textReader.Name);
    Console.WriteLine("Base URI:" + textReader.BaseURI);
    Console.WriteLine("Local Name:" + textReader.LocalName);
    Console.WriteLine("Attribute Count:" + textReader.AttributeCount.ToString());
    Console.WriteLine("Depth:" + textReader.Depth.ToString());
    Console.WriteLine("Line Number:" + textReader.LineNumber.ToString());
    Console.WriteLine("Node Type:" + textReader.NodeType.ToString());
    Console.WriteLine("Attribute Count:" + textReader.Value.ToString());

  • #755945
    If you have not received a validation code by email, please use the "Resend Validation Code" button below to request new validation code. Remember that sometimes the emails from us may go to your BULK mail folder. You may need to check your BULK mail folder to find the verification email.


  • Sign In to post your comments