XmlNode n1 = XmlDoc.CreateElement("Informations");
XmlNode n2 = XmlDoc.CreateElement("Ticket");
n1.AppendChild(n2);.......类似

解决方案 »

  1.   

    也可以:String text = "<Informations>"
    +    "<Ticket Tsn=\"199def5bcd27c1bc\" VoteID=\"39\">"
    +    "<乜 A=\"true\" B=\"false\" />" 
    +   "</Ticket>"
    +  "<Informations>"XmlDocument newNode = new XmlDocument();
    newNode.LoadXml(text);
    XmlNode x = XmlDoc.ImportNode(newNode,true);
    XmlDoc.DocumentElement.LastChild.AppendChild(x);
      

  2.   

    想要的话可以给你个例子,生成的结果如下http://dotnet.aspx.cc/Rss.aspx
      

  3.   

    要啊 
    mail: [email protected]
      

  4.   

    出错啊:  "不能导入“Document”类型的节点。"如下:String text = "<Informations>"
    +    "<Ticket Tsn=\"199def5bcd27c1bc\" VoteID=\"39\">"
    +    "<乜 A=\"true\" B=\"false\" />" 
    +   "</Ticket>"
    +  "<Informations>"XmlDocument xmldoc = new XmlDocument();
    xmldoc.Load("../xml1.xml");XmlDocument newNode = new XmlDocument();
    newNode.LoadXml(text);
    XmlNode x = xmldoc.ImportNode(newNode,true);
    xmldoc.DocumentElement.LastChild.AppendChild(x);
    xmldoc.Save("../xml1.xml");按 孟兄 的意思做,如上, 不知道是否写错, 但出错,
    <我是想把 text 的数据加载到 xml1.xml 中去>
      

  5.   

    XmlNode x = xmldoc.ImportNode(newNode.DocumentElement,true);看看
      

  6.   

    我也想要能不能给我一份
    [email protected]
      

  7.   

    搞定,谢谢孟兄String text = "<Informations>"
    +    "<Ticket Tsn=\"199def5bcd27c1bc\" VoteID=\"39\">"
    +    "<乜 A=\"true\" B=\"false\" />" 
    +   "</Ticket>"
    +  "<Informations>"XmlDocument xmldoc = new XmlDocument();
    xmldoc.Load("../xml1.xml");XmlDocument newNode = new XmlDocument();
    newNode.LoadXml(text);
    XmlNode x = xmldoc.ImportNode(newNode.DocumentElement.LastChild,true);
    xmldoc.DocumentElement.AppendChild(x);
    xmldoc.Save("../xml1.xml");
    xmldoc.Load(fileName);