- Make XmlDocument Instance
- CreateXmlDeclaration
- Create XmlNode. it is root node
- Create another XmlNodes. it is used childNode. these are appended childen to root node
XmlDocument xmlDocument = new XmlDocument(); -- (1)
XmlDeclaration xmlDeclation = xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null); -- (2)
xmlDocument.InsertBefore(xmlDeclation, xmlDocument.DocumentElement);XmlElement rootNode = xmlDocument.CreateElement("SetTeamEXState Message"); --(3)
xmlDocument.AppendChild(rootNode);XmlElement xmlActionNode = xmlDocument.CreateElement("Action");
XmlAttribute targetAttribute = xmlDocument.CreateAttribute("Target");
targetAttribute.Value = ouName;
xmlActionNode.InnerXml = methodName;
xmlActionNode.Attributes.Append(targetAttribute);
rootNode.AppendChild(xmlActionNode);XmlElement xmlMessageNode = xmlDocument.CreateElement("Message");
xmlMessageNode.InnerXml = message;
rootNode.AppendChild(xmlMessageNode);return xmlDocument;