Exemple #1
0
        public static XmlElement GetXmlElement(Guid id, IConfigurationItem item)
        {
            XmlDocument    xDoc       = new XmlDocument();
            XPathNavigator xNavigator = xDoc.CreateNavigator();

            using (XmlWriter writer = xNavigator.AppendChild())
            {
                XmlSerializer ser = new XmlSerializer(item.GetType());
                ser.Serialize(writer, (object)item);
            } // using

            var xAttr = xDoc.CreateAttribute("configurationId");

            xAttr.Value = id.ToString();
            xDoc.DocumentElement.Attributes.Append(xAttr);

            return(xDoc.DocumentElement);
        } // GetXmlElement