Completes: U4-6186 Remove all support for legacy xml schema
This commit is contained in:
@@ -132,17 +132,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty("UseLegacyXmlSchema")]
|
||||
internal InnerTextConfigurationElement<bool> UseLegacyXmlSchema
|
||||
{
|
||||
get
|
||||
{
|
||||
return new OptionalInnerTextConfigurationElement<bool>(
|
||||
(InnerTextConfigurationElement<bool>)this["UseLegacyXmlSchema"],
|
||||
//set the default
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty("ForceSafeAliases")]
|
||||
internal InnerTextConfigurationElement<bool> ForceSafeAliases
|
||||
@@ -336,11 +325,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get { return PropertyContextHelpOption; }
|
||||
}
|
||||
|
||||
bool IContentSection.UseLegacyXmlSchema
|
||||
{
|
||||
get { return UseLegacyXmlSchema; }
|
||||
}
|
||||
|
||||
bool IContentSection.ForceSafeAliases
|
||||
{
|
||||
get { return ForceSafeAliases; }
|
||||
|
||||
@@ -38,8 +38,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
|
||||
string PropertyContextHelpOption { get; }
|
||||
|
||||
bool UseLegacyXmlSchema { get; }
|
||||
|
||||
bool ForceSafeAliases { get; }
|
||||
|
||||
string PreviewBadge { get; }
|
||||
|
||||
@@ -695,35 +695,27 @@ namespace Umbraco.Core.Services
|
||||
public string GetContentTypesDtd()
|
||||
{
|
||||
var dtd = new StringBuilder();
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
|
||||
try
|
||||
{
|
||||
dtd.AppendLine("<!ELEMENT node ANY> <!ATTLIST node id ID #REQUIRED> <!ELEMENT data ANY>");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var strictSchemaBuilder = new StringBuilder();
|
||||
var strictSchemaBuilder = new StringBuilder();
|
||||
|
||||
var contentTypes = GetAllContentTypes();
|
||||
foreach (ContentType contentType in contentTypes)
|
||||
var contentTypes = GetAllContentTypes();
|
||||
foreach (ContentType contentType in contentTypes)
|
||||
{
|
||||
string safeAlias = contentType.Alias.ToUmbracoAlias();
|
||||
if (safeAlias != null)
|
||||
{
|
||||
string safeAlias = contentType.Alias.ToUmbracoAlias();
|
||||
if (safeAlias != null)
|
||||
{
|
||||
strictSchemaBuilder.AppendLine(String.Format("<!ELEMENT {0} ANY>", safeAlias));
|
||||
strictSchemaBuilder.AppendLine(String.Format("<!ATTLIST {0} id ID #REQUIRED>", safeAlias));
|
||||
}
|
||||
strictSchemaBuilder.AppendLine(String.Format("<!ELEMENT {0} ANY>", safeAlias));
|
||||
strictSchemaBuilder.AppendLine(String.Format("<!ATTLIST {0} id ID #REQUIRED>", safeAlias));
|
||||
}
|
||||
|
||||
// Only commit the strong schema to the container if we didn't generate an error building it
|
||||
dtd.Append(strictSchemaBuilder);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Error<ContentTypeService>("Error while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception);
|
||||
}
|
||||
|
||||
// Only commit the strong schema to the container if we didn't generate an error building it
|
||||
dtd.Append(strictSchemaBuilder);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Error<ContentTypeService>("Error while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception);
|
||||
}
|
||||
return dtd.ToString();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Services
|
||||
if (content == null) throw new ArgumentNullException("content");
|
||||
if (urlSegmentProviders == null) throw new ArgumentNullException("urlSegmentProviders");
|
||||
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
var xml = Serialize(dataTypeService, content, content.GetUrlSegment(urlSegmentProviders), nodeName);
|
||||
xml.Add(new XAttribute("nodeType", content.ContentType.Id));
|
||||
@@ -88,7 +88,7 @@ namespace Umbraco.Core.Services
|
||||
if (media == null) throw new ArgumentNullException("media");
|
||||
if (urlSegmentProviders == null) throw new ArgumentNullException("urlSegmentProviders");
|
||||
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
var xml = Serialize(dataTypeService, media, media.GetUrlSegment(urlSegmentProviders), nodeName);
|
||||
xml.Add(new XAttribute("nodeType", media.ContentType.Id));
|
||||
@@ -117,7 +117,7 @@ namespace Umbraco.Core.Services
|
||||
public XElement Serialize(IDataTypeService dataTypeService, IMember member)
|
||||
{
|
||||
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : member.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = member.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
var xml = Serialize(dataTypeService, member, "", nodeName);
|
||||
xml.Add(new XAttribute("nodeType", member.ContentType.Id));
|
||||
@@ -133,16 +133,10 @@ namespace Umbraco.Core.Services
|
||||
public XElement Serialize(IDataTypeService dataTypeService, Property property)
|
||||
{
|
||||
var propertyType = property.PropertyType;
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
|
||||
var nodeName = property.Alias.ToSafeAlias();
|
||||
|
||||
var xElement = new XElement(nodeName);
|
||||
|
||||
//Add the property alias to the legacy schema
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema)
|
||||
{
|
||||
var a = new XAttribute("alias", property.Alias.ToSafeAlias());
|
||||
xElement.Add(a);
|
||||
}
|
||||
|
||||
//Get the property editor for thsi property and let it convert it to the xml structure
|
||||
var propertyEditor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias);
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="XElement"/> containing the xml representation of the Content object</returns>
|
||||
public XElement Export(IContent content, bool deep = false, bool raiseEvents = true)
|
||||
{
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
if (raiseEvents)
|
||||
{
|
||||
@@ -1279,7 +1279,7 @@ namespace Umbraco.Core.Services
|
||||
/// <returns><see cref="XElement"/> containing the xml representation of the Media object</returns>
|
||||
public XElement Export(IMedia media, bool deep = false, bool raiseEvents = true)
|
||||
{
|
||||
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck();
|
||||
|
||||
if (raiseEvents)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user