C#处理XML

读取XML返回结果

DealerService.DealerService dealerWS = new DealerService.DealerService();
                            string ChannelInfo = dealerWS.GetCustomerChannel(Acctid);
                            XmlDocument ChannelInfoXml = new XmlDocument();
                            ChannelInfoXml.LoadXml(ChannelInfo);

                            string Channel = ChannelInfoXml.DocumentElement.SelectSingleNode("err/info").InnerText;


构造XML节点

MailService.WebService mail = new WebService();
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml("<Mail><Parameters></Parameters></Mail>");
                    XmlNode node = xml.DocumentElement.SelectSingleNode("Parameters");
                    //node.AppendChild(xml.CreateElement("BBN")).InnerText = BBN;
                    node.AppendChild(xml.CreateElement("Email")).InnerText = Email;
                    node.AppendChild(xml.CreateElement("Promotioncode")).InnerText = Code;
                    node.AppendChild(xml.CreateElement("UserName")).InnerText = UserName;
                    node.AppendChild(xml.CreateElement("SDate")).InnerText = SignUpDate;
                    string Message = mail.SendMail(0, Email, "AD:Temp-Event_US-06", xml.OuterXml);
                    XmlDocument mailXml = new XmlDocument();
                    mailXml.LoadXml(Message);
                    string mailErrCode = mailXml.DocumentElement.SelectSingleNode("err/code").InnerText;
                    string mailErrInfo = mailXml.DocumentElement.SelectSingleNode("err/info").InnerText;
                    if (mailErrCode != "0")//failure
                    {
                        string errorinfo = "AccountID:" + acctid + " EmailAdress:" + Email + " Code:" + Code;
                        Log.Error("Send mail failure.Error info:" + errorinfo);
                        return 1;
                    }
                    return 0;


你可能感兴趣的:(xml,String,webservice,C#,Parameters,email)