/ Published in: C#
Example uses an object from 3rd party API. Needed to turn it into xml for returning from a webservice.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private XmlDocument getXmlResults(CM.Result<int> resultsFromApi) { XmlElement root = returnXmlDoc.CreateElement("result"); XmlNode code = returnXmlDoc.CreateNode(XmlNodeType.Element, "code", null); code.InnerText = resultsFromApi.Code.ToString(); XmlNode message = returnXmlDoc.CreateNode(XmlNodeType.Element, "message", null); message.InnerText = resultsFromApi.Message; root.AppendChild(code); root.AppendChild(message); returnXmlDoc.AppendChild(root); return returnXmlDoc; }