1.怎么创建
2.怎么把"123"这个字符串存进去
3.怎么把"123"读取出来
4.怎么遍历所有存进去的字符串
5.能不能存入Bitmap等..
谢谢

解决方案 »

  1.   

    http://blog.csdn.net/mengxj85/archive/2008/09/30/3005557.aspx
      

  2.   

    这些问题楼主应该去看教程啊,VS2008还可以用linq来做你说的那几个
      

  3.   

    你问的这个问题面太大,没法回答。请先看看xml基础吧。1,创建xml方法也很多,一般采用FileStream的Write方法创建较多
    2,3面太广,没法回答
    4,LINQ TO XML或将xml读入数据集然后遍历
    5,不明白什么意思
      

  4.   

    http://www.alixixi.com/program/a/2008050727580.shtml再来一个更详细的教程这种问题最好先百度,然后再来问,这样大家回答才有目的性
      

  5.   

    System.Xml.XmlDocument doc = new XmlDocument();
    XmlNode root =doc.CreateElement("Setting");
      

  6.   


    C# 建立xml文件的方法
                string xmlFile = System.Windows.Forms.Application.StartupPath + "\\system.xml";            XmlDocument xml = new XmlDocument();        //建立XmlDomcument对象   
                XmlDeclaration Declaration = xml.CreateXmlDeclaration("1.0", "utf-8", null);    //Xml Declaration(Xml声明)   
                XmlNode RootNode = xml.CreateNode(XmlNodeType.Element, "", "ROOT", "");
                xml.AppendChild(RootNode);                XmlNode node1 = xml.CreateNode(XmlNodeType.Element, "", "频率范围", "");
                    node1.Attributes.Append(xml.CreateAttribute("VALUE")).InnerText = 123;        
                   xml.InsertBefore(Declaration, xml.DocumentElement);
                try
                {
                    xml.Normalize();
                    xml.Save(xmlFile);
                }
                catch (Exception ex)
                {
                    // 显示错误信息
                    MessageBox.Show("保存xml文件出错:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
    读: XmlDocument xml = new XmlDocument();
                if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\system.xml"))
                {
                    xml.Load(System.Windows.Forms.Application.StartupPath + "\\system.xml");
                    XmlNode root = xml.DocumentElement;//读取XML的根节点
                    foreach (XmlNode node in root.ChildNodes)//对子节点进行循环 
                    {
                        if (node.HasChildNodes)
                        {
                            string str = wavecomboBox.Text.Substring(0, wavecomboBox.Text.Length - 2);
                            if (node.Attributes["VALUE"].Value == str)
                            {
                                foreach (XmlNode childnode in node.ChildNodes)
                                {
                                    if (childnode.Name == "霍尔")
                                    {
                                        choicehall = int.Parse(childnode.InnerText);
                                    }
                                    else if (childnode.Name == "温度")
                                    {
                                        choiceTemp = int.Parse(childnode.InnerText) * 10;
                                    }
                                    else if (childnode.Name == "LT")
                                    {
                                        choiceLTVolt = int.Parse(childnode.InnerText);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("配置文件未找到,请确认程序文件夹下是否存在“System.xml”这个文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
      

  7.   

    XML成为可扩展性标记性语言,在.NET框架中可以说是非常重要的一部分,它用于描述数据。在该项目中添加XML文件XML文件是以节点的形式存在的,并且区分大小写,描述的每个数据的各个节点都可以自由的扩展。
    <student>
    <name>jack</name>
    <age>22</age>
    <name>rose</name>
    <age>21</age>
    </student>
    读取:
    要想操作XML文件,需要引入System.XML命名空间1、实例化XmlDocument对象,该对象可标识整个XML文档 
    2、利用它的Load()方法将指定的XML文档加载如该XmlDocument对象
    3、获取该文档的根节点 节点对象为XmlNode
    4、遍历循环其下子节点
    XmlDocument myxml = new XmlDocument();
    myxml.Load("指定XML文件");
    XmlNode node = myxml.DocumentElement;foreach(XmlNode demoNode in node.ChildNodes)
    {
        switch(demoNode.Name)
       {     //执行代码
       }
    }