잊지 않겠습니다.

'XmlDocument'에 해당되는 글 1건

  1. 2009.01.07 Make XML Document using System.Xml.XmlDocument
  1. Make XmlDocument Instance
  2. CreateXmlDeclaration
  3. Create XmlNode. it is root node
  4. 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;

신고
Posted by xyzlast Y2K


티스토리 툴바