xml又是如何接收呢?

解决方案 »

  1.   

    这个问题很简单.
    XmlDocument doc=new XmlDocument();
    doc.load(xml路径);
    XmlNode root=doc.SelectSingleNode("Setup");
    XmlElement xe=doc.CreateElement("Path");
    xe.SetAttribute("Folder",textBox1.Text.Trim());
    xe.InnerText=textBox2.Text.Trim();
    .AppendChild(xe);
    doc.Save(path);
    大概写了一下.你自己看着办吧.
      

  2.   

    private bool InsertSqlStr()
    {
    if(SqlStr.Text != "")
    {
    XmlDocument myXmlDocument = new XmlDocument();
    myXmlDocument.Load("NewTemplet.xml");
    XmlElement myelement = myXmlDocument.CreateElement("values");
    myelement.InnerText = SqlStr.Text;
    XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname");
    myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(","));
    myelement.Attributes.Append(myattribute);
    myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement);
    myXmlDocument.Save("NewTemplet.xml");
    return true;
    }
    return false;
    }
      

  3.   

    上面的乱了,再发一次。
    private bool InsertSqlStr()
    {
    if(SqlStr.Text != "")
    {
    XmlDocument myXmlDocument = new XmlDocument();
    myXmlDocument.Load("NewTemplet.xml");
    XmlElement myelement = myXmlDocument.CreateElement("values");
    myelement.InnerText = SqlStr.Text;
    XmlAttribute myattribute = myXmlDocument.CreateAttribute("vname");
    myattribute.Value = ParaValue.Text.Substring(0,ParaValue.Text.IndexOf(","));
    myelement.Attributes.Append(myattribute);
    myXmlDocument.SelectSingleNode("//sql").AppendChild(myelement);
    myXmlDocument.Save("NewTemplet.xml");
    return true;
    }
    return false;
    }