I have written a code in C# to parse the data from an XML file (Monodevelop). I used (using System.Xml) and (namespace).It gives an error in the (using System.Xml) The type and namespace name “Xml” does not exist in the namespace. I am new to programming. So , Kindly help me what should I do ?
using System;
using System.Xml;
namespace ReadXMLfromFile
{
class sample
{
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader ("sample.xml ");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an element.
Console.Write("<" + reader.Name);
Console.WriteLine(">");
break;
case XmlNodeType.Text: //Display the text in each
element.
Console.WriteLine (reader.Value);
break;
case XmlNodeType.EndElement: //Display the end of the
element.
Console.Write ("</" + reader.Name);
Console.WriteLine(">");
break;
}
}
Console.ReadLine();
}
}
}
Have you added a reference to the assembly System.Xml in the project file (Folder References)?