创建Xml的将但方法和向Xml中添加数据

时间:2025-01-20 11:35:44
</SendUserId>
// ::</DateTime>
</AcceptUserId>
       <AcceptUserId></AcceptUserId>
     </ListUser>
   </Cast>
 </Root>
 
 C#代码
                        {
             XmlDocument xmldoc =              XmlNode xmlnode = xmldoc.CreateXmlDeclaration(             xmldoc.AppendChild(xmlnode);
                          XmlElement xmlroot = xmldoc.CreateElement( 
 
                          XmlElement xmlcast = xmldoc.CreateElement(             xmlroot.AppendChild(xmlcast);
                          XmlElement xmlsend = xmldoc.CreateElement(             xmlsend.InnerText = WangCaiConfig.User.Id.ToString();
             xmlcast.AppendChild(xmlsend);
 
             XmlElement xmlsubject = xmldoc.CreateElement(             xmlsubject.InnerText = title;
             xmlcast.AppendChild(xmlsubject);
 
             XmlElement xmlcontent = xmldoc.CreateElement(             xmlcontent.InnerText = content;
             xmlcast.AppendChild(xmlcontent);
 
             XmlElement xmltime = xmldoc.CreateElement(             xmltime.InnerText = DateTime.Now.ToString();
             xmlcast.AppendChild(xmltime);
 
                          XmlElement xmllist = xmldoc.CreateElement(             xmlcast.AppendChild(xmllist);
 
                          ; i < userIdList.Length - ; i++)
             {
                                  XmlElement xmlAcceptId = xmldoc.CreateElement(                 xmlAcceptId.InnerText = userIdList[i].ToString();
                 xmllist.AppendChild(xmlAcceptId);
             }
                          xmldoc.AppendChild(xmlroot);
             xmldoc.Save(WangCaiConfig.GetCurrentDirectory() + "UserXML/BoradCast.xml");

相关文章