public override IContentType Create(string filename, int parentId) { var xml = XElement.Load(filename); if (xml.Name.LocalName != "DocumentType") { return(null); } var info = xml.Element("Info"); var alias = info.Element("Alias").Value; var contentTypeOptions = new ContentTypeInfo() { Key = Guid.Parse(info.Element("Key").Value), Name = info.Element("Name").Value, AllowAtRoot = bool.Parse(info.Element("AllowAtRoot").Value), Description = info.Element("Description").Value, Icon = info.Element("Icon").Value, Thumbnail = info.Element("Thumbnail").Value, }; var compXml = info.Element("Compositions"); foreach (var compositionXml in compXml.Elements("Composition")) { contentTypeOptions.Compositions.Add( Guid.Parse(compositionXml.Attribute("Key").Value), compositionXml.Value); } var structXml = xml.Element("Structure"); foreach (var doctype in structXml.Elements("DocumentType")) { contentTypeOptions.Allowed.Add( Guid.Parse(doctype.Attribute("Key").Value), doctype.Value); } var templatesXml = xml.Element("AllowedTemplates"); foreach (var template in templatesXml.Elements("Template")) { contentTypeOptions.Templates.Add(template.Value); } var propertiesXml = xml.Element("GenericProperties"); foreach (var propXml in propertiesXml.Elements("GenericProperty")) { var tabName = propXml.Element("Tab").Value; var tab = contentTypeOptions.Tabs.FirstOrDefault(x => x.TabName == tabName); if (tab == null) { tab = new ContentTypeTab() { TabName = tabName }; contentTypeOptions.Tabs.Add(tab); } tab.Properties.Add(new ContentTypeProperty() { Alias = propXml.Element("Alias").Value, Mandatory = bool.Parse(propXml.Element("Mandatory").Value), Name = propXml.Element("Name").Value, Description = propXml.Element("Description").Value, SortOrder = int.Parse(propXml.Element("SortOrder").Value), Validation = propXml.Element("Validation").Value, DataType = propXml.Element("Type").Value }); } return(Create(alias, contentTypeOptions)); }