Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XML c#解析时卡住_C#_Xml_Parsing_Monodevelop - Fatal编程技术网

XML c#解析时卡住

XML c#解析时卡住,c#,xml,parsing,monodevelop,C#,Xml,Parsing,Monodevelop,我用C#编写了一段代码来解析XML文件中的数据(Monodevelop)。我使用了(使用System.Xml)和(namespace)。它在(使用System.Xml)中给出了一个错误,名称空间中不存在类型和名称空间名称“Xml”。我是编程新手。那么,请帮帮我,我该怎么办 using System; using System.Xml; namespace ReadXMLfromFile { class sample { static void Main(string

我用C#编写了一段代码来解析XML文件中的数据(Monodevelop)。我使用了(使用System.Xml)和(namespace)。它在(使用System.Xml)中给出了一个错误,名称空间中不存在类型和名称空间名称“Xml”。我是编程新手。那么,请帮帮我,我该怎么办

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();
    }
}
使用系统;
使用System.Xml;
名称空间ReadXMLfromFile
{
类样本
{
静态void Main(字符串[]参数)
{
XmlTextReader=新的XmlTextReader(“sample.xml”);
while(reader.Read())
{
开关(reader.NodeType)
{
case XmlNodeType.Element://节点是一个元素。
控制台。写(“”);
打破
case XmlNodeType.Text://在每个
元素。
Console.WriteLine(reader.Value);
打破
case XmlNodeType.EndElement://显示
元素。
控制台。写(“”);
打破
}
}
Console.ReadLine();
}
}

}

是否在项目文件(文件夹引用)中添加了对assembly System.Xml的引用?

是否在项目文件(文件夹引用)中添加了对assembly System.Xml的引用?

显示代码和示例Xml!如果您使用的是Monodevelop并针对Mono进行编译,那么您不应该使用System.Xml,而应该使用Mono等价物。Monodevelop的System.Xml等价物是什么?向我们展示代码和示例Xml!如果使用Monodevelop并针对Mono进行编译,则不应使用System.Xml,而应使用Mono等效项。Monodevelop的System.Xml等效项是什么?是的,我已在项目文件和调试文件夹中添加了System.XmlSI在Dektop中创建了项目,并将库粘贴到项目和bin以及调试文件夹中。是的,我已经在项目文件和调试文件夹中添加了System.Xml:SI在Dektop中创建项目,并将库粘贴到项目和bin以及调试文件夹中。