Return to Snippet

Revision: 12287
at March 9, 2009 11:23 by jasonseney


Updated Code
private XmlDocument getXmlResults(CM.Result<int> resultsFromApi) {
	XmlDocument returnXmlDoc = new XmlDocument();

	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;
}

Revision: 12286
at March 9, 2009 11:22 by jasonseney


Initial Code
private XmlDocument getXmlResults(CM.Result<int> resultsFromApi) {
	XmlDocument returnXmlDoc = new XmlDocument();

	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;
}

Initial URL

                                

Initial Description
Example uses an object from 3rd party API. Needed to turn it into xml for returning from a webservice.

Initial Title
Create basic XmlDocument from Scratch

Initial Tags
xml, c

Initial Language
C#