private string ConverXml(string memberId, int code, string msg)
{
var resp = new { authenticate = new { member_id = memberId, status_code = code, message = msg } };
var jsonstr = JsonConvert.SerializeObject(resp);
XmlDocument doc = JsonConvert.DeserializeXmlNode(jsonstr);
XmlDeclaration xmldecl = doc.CreateXmlDeclaration("1.0", "utf-8", "yes");
XmlElement root = doc.DocumentElement;
doc.InsertBefore(xmldecl, root);
return doc.InnerXml;
}
返回XML