using System; using System.Xml; using System.Xml.Linq; namespace Umbraco.Core.Models { public static class PropertyExtensions { /// /// Creates the xml representation for the object /// /// to generate xml for /// Xml of the property and its value public static XElement ToXml(this Property property) { string nodeName = property.Alias.ToUmbracoAlias(); var xd = new XmlDocument(); XmlNode xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, ""); xmlNode.AppendChild(property.PropertyType.DataType(property.Id).Data.ToXMl(xd)); var element = xmlNode.GetXElement(); return element; } } }