V12: Deprecate XPath (#14372)

* Deprecate all outward facing methods that uses XPath

* Add more obsolete messages

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
Nikolaj Geisle
2023-07-07 11:12:04 +02:00
committed by GitHub
parent 16c78b76dd
commit d116366b28
41 changed files with 97 additions and 0 deletions

View File

@@ -24,6 +24,8 @@ public class ContentErrorPage : ValidatableEntryBase
/// <summary>
/// Gets or sets a value for the content XPath.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public string? ContentXPath { get; set; }
/// <summary>
@@ -39,6 +41,7 @@ public class ContentErrorPage : ValidatableEntryBase
/// <summary>
/// Gets a value indicating whether the <see cref="ContentXPath" /> field is populated.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public bool HasContentXPath => !string.IsNullOrEmpty(ContentXPath);
/// <summary>

View File

@@ -34,6 +34,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNodeList? SelectNodes(this XmlNode source, string expression, IEnumerable<XPathVariable>? variables)
{
XPathVariable[]? av = variables?.ToArray();
@@ -56,6 +57,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNodeList? SelectNodes(this XmlNode source, XPathExpression expression, IEnumerable<XPathVariable>? variables)
{
XPathVariable[]? av = variables?.ToArray();
@@ -78,6 +80,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNodeList? SelectNodes(this XmlNode source, string? expression, params XPathVariable[]? variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
@@ -105,6 +108,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNodeList SelectNodes(this XmlNode source, XPathExpression expression, params XPathVariable[]? variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
@@ -132,6 +136,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNode? SelectSingleNode(this XmlNode source, string expression, IEnumerable<XPathVariable>? variables)
{
XPathVariable[]? av = variables?.ToArray();
@@ -154,6 +159,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNode? SelectSingleNode(this XmlNode source, XPathExpression expression, IEnumerable<XPathVariable>? variables)
{
XPathVariable[]? av = variables?.ToArray();
@@ -176,6 +182,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNode? SelectSingleNode(this XmlNode source, string expression, params XPathVariable[]? variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
@@ -202,6 +209,7 @@ public static class XmlExtensions
/// </para>
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNode? SelectSingleNode(this XmlNode source, XPathExpression expression, params XPathVariable[]? variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)

View File

@@ -69,6 +69,8 @@ public interface IPublishedProperty
/// <para>It must be either null, or a string, or an XPathNavigator.</para>
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
object? GetXPathValue(string? culture = null, string? segment = null);
/// <summary>

View File

@@ -113,6 +113,7 @@ public interface IPublishedPropertyType
/// <remarks>
/// <para>The XPath value can be either a string or an XPathNavigator.</para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
object? ConvertInterToXPath(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview);
/// <summary>

View File

@@ -46,6 +46,7 @@ public abstract class PublishedPropertyBase : IPublishedProperty
public abstract object? GetValue(string? culture = null, string? segment = null);
/// <inheritdoc />
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract object? GetXPathValue(string? culture = null, string? segment = null);
/// <inheritdoc />

View File

@@ -273,6 +273,7 @@ namespace Umbraco.Cms.Core.Models.PublishedContent
}
/// <inheritdoc />
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public object? ConvertInterToXPath(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
{
if (!_initialized)

View File

@@ -58,6 +58,7 @@ public class RawValueProperty : PublishedPropertyBase
public override object? GetValue(string? culture = null, string? segment = null)
=> string.IsNullOrEmpty(culture) & string.IsNullOrEmpty(segment) ? _objectValue.Value : null;
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? GetXPathValue(string? culture = null, string? segment = null)
=> string.IsNullOrEmpty(culture) & string.IsNullOrEmpty(segment) ? _xpathValue.Value : null;

View File

@@ -128,5 +128,6 @@ public interface IPropertyValueConverter : IDiscoverable
/// the cache levels of property values. It is not meant to be used by the converter.
/// </para>
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview);
}

View File

@@ -49,6 +49,7 @@ public abstract class PropertyValueConverterBase : IPropertyValueConverter
=> inter;
/// <inheritdoc />
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public virtual object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
{
var d = new XmlDocument();

View File

@@ -51,6 +51,7 @@ public class TextStringValueConverter : PropertyValueConverterBase, IDeliveryApi
// source should come from ConvertSource and be a string (or null) already
inter ?? string.Empty;
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview) =>
// source should come from ConvertSource and be a string (or null) already

View File

@@ -86,6 +86,7 @@ public class ContentPickerValueConverter : PropertyValueConverterBase, IDelivery
return content ?? inter;
}
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
{
if (inter == null)

View File

@@ -39,6 +39,7 @@ public class DatePickerValueConverter : PropertyValueConverterBase
}
// default ConvertSourceToObject just returns source ie a DateTime value
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? ConvertIntermediateToXPath(
IPublishedElement owner,
IPublishedPropertyType propertyType,

View File

@@ -57,6 +57,7 @@ public class MultipleTextStringValueConverter : PropertyValueConverterBase
: values.ToArray();
}
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
{
var d = new XmlDocument();

View File

@@ -31,6 +31,7 @@ public class SimpleTinyMceValueConverter : PropertyValueConverterBase
// source should come from ConvertSource and be a string (or null) already
new HtmlEncodedString(inter == null ? string.Empty : (string)inter);
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview) =>
// source should come from ConvertSource and be a string (or null) already

View File

@@ -56,6 +56,7 @@ public class YesNoValueConverter : PropertyValueConverterBase
}
// default ConvertSourceToObject just returns source ie a boolean value
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview) =>
// source should come from ConvertSource and be a boolean already

View File

@@ -102,6 +102,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The content, or null.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IPublishedContent? GetSingleByXPath(bool preview, string xpath, params XPathVariable[] vars);
/// <summary>
@@ -111,6 +112,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The content, or null.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IPublishedContent? GetSingleByXPath(string xpath, params XPathVariable[] vars);
/// <summary>
@@ -121,6 +123,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The content, or null.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IPublishedContent? GetSingleByXPath(bool preview, XPathExpression xpath, params XPathVariable[] vars);
/// <summary>
@@ -130,6 +133,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The content, or null.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IPublishedContent? GetSingleByXPath(XPathExpression xpath, params XPathVariable[] vars);
/// <summary>
@@ -140,6 +144,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The contents.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> GetByXPath(bool preview, string xpath, params XPathVariable[] vars);
/// <summary>
@@ -149,6 +154,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The contents.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> GetByXPath(string xpath, params XPathVariable[] vars);
/// <summary>
@@ -159,6 +165,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The contents.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> GetByXPath(bool preview, XPathExpression xpath, params XPathVariable[] vars);
/// <summary>
@@ -168,6 +175,7 @@ public interface IPublishedCache : IXPathNavigable
/// <param name="vars">Optional XPath variables.</param>
/// <returns>The contents.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> GetByXPath(XPathExpression xpath, params XPathVariable[] vars);
/// <summary>
@@ -179,6 +187,7 @@ public interface IPublishedCache : IXPathNavigable
/// <para>The value of <paramref name="preview" /> overrides the context.</para>
/// <para>The navigator is already a safe clone (no need to clone it again).</para>
/// </remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
XPathNavigator CreateNavigator(bool preview);
/// <summary>
@@ -196,6 +205,7 @@ public interface IPublishedCache : IXPathNavigable
/// </para>
/// <para>If the node does not exist, returns null.</para>
/// </remarks>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
XPathNavigator? CreateNodeNavigator(int id, bool preview);
/// <summary>

View File

@@ -38,20 +38,26 @@ public sealed class InternalPublishedContentCache : PublishedCacheBase, IPublish
public override IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null) =>
_content.Values.Where(x => x.Parent == null);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent GetSingleByXPath(bool preview, string xpath, XPathVariable[] vars) =>
throw new NotImplementedException();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent GetSingleByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars) =>
throw new NotImplementedException();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IEnumerable<IPublishedContent> GetByXPath(bool preview, string xpath, XPathVariable[] vars) =>
throw new NotImplementedException();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IEnumerable<IPublishedContent>
GetByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars) => throw new NotImplementedException();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override XPathNavigator CreateNavigator(bool preview) => throw new NotImplementedException();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override XPathNavigator CreateNodeNavigator(int id, bool preview) => throw new NotImplementedException();
public override bool HasContent(bool preview) => _content.Count > 0;

View File

@@ -13,6 +13,7 @@ public class InternalPublishedProperty : IPublishedProperty
public bool SolidHasValue { get; set; }
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public object? SolidXPathValue { get; set; }
public object? SolidDeliveryApiValue { get; set; }
@@ -25,6 +26,7 @@ public class InternalPublishedProperty : IPublishedProperty
public virtual object? GetValue(string? culture = null, string? segment = null) => SolidValue;
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public virtual object? GetXPathValue(string? culture = null, string? segment = null) => SolidXPathValue;
public virtual object? GetDeliveryApiValue(bool expanding, string? culture = null, string? segment = null) => SolidDeliveryApiValue;

View File

@@ -40,31 +40,42 @@ public abstract class PublishedCacheBase : IPublishedCache
public IEnumerable<IPublishedContent> GetAtRoot(string? culture = null) => GetAtRoot(PreviewDefault, culture);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract IPublishedContent? GetSingleByXPath(bool preview, string xpath, XPathVariable[] vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IPublishedContent? GetSingleByXPath(string xpath, XPathVariable[] vars) =>
GetSingleByXPath(PreviewDefault, xpath, vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract IPublishedContent? GetSingleByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IPublishedContent? GetSingleByXPath(XPathExpression xpath, XPathVariable[] vars) =>
GetSingleByXPath(PreviewDefault, xpath, vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract IEnumerable<IPublishedContent> GetByXPath(bool preview, string xpath, XPathVariable[] vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> GetByXPath(string xpath, XPathVariable[] vars) =>
GetByXPath(PreviewDefault, xpath, vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract IEnumerable<IPublishedContent>
GetByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> GetByXPath(XPathExpression xpath, XPathVariable[] vars) =>
GetByXPath(PreviewDefault, xpath, vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract XPathNavigator CreateNavigator(bool preview);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public XPathNavigator CreateNavigator() => CreateNavigator(PreviewDefault);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public abstract XPathNavigator? CreateNodeNavigator(int id, bool preview);
public abstract bool HasContent(bool preview);

View File

@@ -201,6 +201,7 @@ internal class PublishedElementPropertyBase : PublishedPropertyBase
}
}
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? GetXPathValue(string? culture = null, string? segment = null)
{
GetCacheLevels(out PropertyCacheLevel cacheLevel, out PropertyCacheLevel referenceCacheLevel);

View File

@@ -118,6 +118,7 @@ namespace Umbraco.Cms.Core.Xml
/// <summary>
/// Same as <see cref="XsltContext"/>.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override bool PreserveWhitespace(XPathNavigator node)
{
return true;
@@ -140,6 +141,7 @@ namespace Umbraco.Cms.Core.Xml
/// </summary>
/// <param name="xpath">The expression to compile</param>
/// <returns>A compiled <see cref="XPathExpression"/>.</returns>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XPathExpression? Compile(string xpath)
{
return new XmlDocument().CreateNavigator()?.Compile(xpath);
@@ -203,6 +205,7 @@ namespace Umbraco.Cms.Core.Xml
/// <summary>
/// See <see cref="XsltContext"/>. Not used in our implementation.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes) => throw new NotImplementedException();
/// <summary>

View File

@@ -6,6 +6,7 @@ namespace Umbraco.Cms.Core.Xml;
/// This is used to parse our customize Umbraco XPath expressions (i.e. that include special tokens like $site) into
/// a real XPath statement
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public class UmbracoXPathPathSyntaxParser
{
[Obsolete("This will be removed in Umbraco 13. Use ParseXPathQuery which accepts a parentId instead")]

View File

@@ -3,6 +3,7 @@ namespace Umbraco.Cms.Core.Xml.XPath;
/// <summary>
/// Represents a content that can be navigated via XPath.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public interface INavigableContent
{
/// <summary>

View File

@@ -3,6 +3,7 @@ namespace Umbraco.Cms.Core.Xml.XPath;
/// <summary>
/// Represents the type of a content that can be navigated via XPath.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public interface INavigableContentType
{
/// <summary>

View File

@@ -4,6 +4,7 @@ namespace Umbraco.Cms.Core.Xml.XPath;
/// Represents the type of a field of a content that can be navigated via XPath.
/// </summary>
/// <remarks>A field can be an attribute or a property.</remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public interface INavigableFieldType
{
/// <summary>

View File

@@ -3,6 +3,7 @@ namespace Umbraco.Cms.Core.Xml.XPath;
/// <summary>
/// Represents a source of content that can be navigated via XPath.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public interface INavigableSource
{
/// <summary>

View File

@@ -7,6 +7,7 @@ namespace Umbraco.Cms.Core.Xml.XPath
/// <summary>
/// Provides a cursor model for navigating {macro /} as if it were XML.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public class MacroNavigator : XPathNavigator
{
private readonly XmlNameTable _nameTable;

View File

@@ -21,6 +21,8 @@ namespace Umbraco.Cms.Core.Xml.XPath;
/// <summary>
/// Provides a cursor model for navigating Umbraco data as if it were XML.
/// </summary>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public class NavigableNavigator : XPathNavigator
{
// "The XmlNameTable stores atomized strings of any local name, namespace URI,

View File

@@ -3,6 +3,7 @@ using System.Xml.XPath;
namespace Umbraco.Cms.Core.Xml.XPath;
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public class RenamedRootNavigator : XPathNavigator
{
private readonly XPathNavigator _navigator;

View File

@@ -18,6 +18,7 @@ public static class XPathNavigatorExtensions
/// <param name="expression">An XPath expression.</param>
/// <param name="variables">A set of XPathVariables.</param>
/// <returns>An iterator over the nodes matching the specified expression.</returns>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XPathNodeIterator Select(this XPathNavigator navigator, string expression, params XPathVariable[] variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
@@ -50,6 +51,7 @@ public static class XPathNavigatorExtensions
/// <param name="expression">An XPath expression.</param>
/// <param name="variables">A set of XPathVariables.</param>
/// <returns>An iterator over the nodes matching the specified expression.</returns>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XPathNodeIterator Select(this XPathNavigator navigator, XPathExpression expression, params XPathVariable[] variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)

View File

@@ -6,6 +6,7 @@ namespace Umbraco.Cms.Core.Xml;
/// Represents a variable in an XPath query.
/// </summary>
/// <remarks>The name must be <c>foo</c> in the constructor and <c>$foo</c> in the XPath query.</remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public class XPathVariable
{
/// <summary>

View File

@@ -76,6 +76,7 @@ public class XmlHelper
/// </summary>
/// <param name="xml">The xml string.</param>
/// <returns>An <c>XPathDocument</c> created from the xml string.</returns>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XPathDocument CreateXPathDocument(string xml) =>
new XPathDocument(new XmlTextReader(new StringReader(xml)));
@@ -85,6 +86,7 @@ public class XmlHelper
/// <param name="xml">The xml string.</param>
/// <param name="doc">The XPath document.</param>
/// <returns>A value indicating whether it has been possible to create the document.</returns>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static bool TryCreateXPathDocument(string xml, out XPathDocument? doc)
{
try
@@ -106,6 +108,7 @@ public class XmlHelper
/// <param name="doc">The XPath document.</param>
/// <returns>A value indicating whether it has been possible to create the document.</returns>
/// <remarks>The value can be anything... Performance-wise, this is bad.</remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static bool TryCreateXPathDocumentFromPropertyValue(object value, out XPathDocument? doc)
{
// DynamicNode.ConvertPropertyValueByDataType first cleans the value by calling
@@ -155,6 +158,7 @@ public class XmlHelper
/// <param name="parentNode">The parent node.</param>
/// <param name="childNodesXPath">An XPath expression to select children of <paramref name="parentNode" /> to sort.</param>
/// <param name="orderBy">A function returning the value to order the nodes by.</param>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static void SortNodes(
XmlNode parentNode,
string childNodesXPath,
@@ -187,6 +191,7 @@ public class XmlHelper
/// Assuming all nodes but <paramref name="node" /> are sorted, this will move the node to
/// the right position without moving all the nodes (as SortNodes would do) - should improve perfs.
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static bool SortNode(
XmlNode parentNode,
string childNodesXPath,

View File

@@ -27,6 +27,7 @@ public class XmlNodeListFactory
/// an object inheriting <see cref="XmlNode" />, such as
/// <see cref="XmlDocument" />.
/// </remarks>
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public static XmlNodeList CreateNodeList(XPathNodeIterator? iterator) => new XmlNodeListIterator(iterator);
#endregion Public members

View File

@@ -18,6 +18,7 @@ public interface IPublishedContentQuery
IPublishedContent? Content(object id);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IPublishedContent? ContentSingleAtXPath(string xpath, params XPathVariable[] vars);
IEnumerable<IPublishedContent> Content(IEnumerable<int> ids);
@@ -26,8 +27,10 @@ public interface IPublishedContentQuery
IEnumerable<IPublishedContent> Content(IEnumerable<object> ids);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> ContentAtXPath(string xpath, params XPathVariable[] vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars);
IEnumerable<IPublishedContent> ContentAtRoot();

View File

@@ -56,6 +56,7 @@ public class MarkdownEditorValueConverter : PropertyValueConverterBase, IDeliver
return new HtmlEncodedString(inter == null ? string.Empty : mark.Transform((string)inter));
}
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview) =>
// source should come from ConvertSource and be a string (or null) already

View File

@@ -129,6 +129,7 @@ public class PublishedContentQuery : IPublishedContentQuery
return null;
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IPublishedContent? ContentSingleAtXPath(string xpath, params XPathVariable[] vars)
=> ItemByXPath(xpath, vars, _publishedSnapshot.Content);
@@ -141,9 +142,11 @@ public class PublishedContentQuery : IPublishedContentQuery
public IEnumerable<IPublishedContent> Content(IEnumerable<object> ids)
=> ids.Select(Content).WhereNotNull();
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> ContentAtXPath(string xpath, params XPathVariable[] vars)
=> ItemsByXPath(xpath, vars, _publishedSnapshot.Content);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars)
=> ItemsByXPath(xpath, vars, _publishedSnapshot.Content);

View File

@@ -360,6 +360,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
? _snapshot.IsEmpty == false
: _snapshot.GetAtRoot().Any(x => x.PublishedModel != null);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent? GetSingleByXPath(bool preview, string xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -367,6 +368,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
return GetSingleByXPath(iterator);
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent? GetSingleByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -386,6 +388,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
return xcontent?.InnerContent;
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IEnumerable<IPublishedContent> GetByXPath(bool preview, string xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -393,6 +396,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
return GetByXPath(iterator);
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IEnumerable<IPublishedContent> GetByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -416,6 +420,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
}
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override XPathNavigator CreateNavigator(bool preview)
{
var source = new Source(this, preview);
@@ -423,6 +428,7 @@ public class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigab
return navigator;
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override XPathNavigator? CreateNodeNavigator(int id, bool preview)
{
var source = new Source(this, preview);

View File

@@ -95,6 +95,7 @@ public class MediaCache : PublishedCacheBase, IPublishedMediaCache, INavigableDa
#region XPath
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent? GetSingleByXPath(bool preview, string xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -102,6 +103,7 @@ public class MediaCache : PublishedCacheBase, IPublishedMediaCache, INavigableDa
return GetSingleByXPath(iterator);
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IPublishedContent? GetSingleByXPath(bool preview, XPathExpression xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);
@@ -109,6 +111,7 @@ public class MediaCache : PublishedCacheBase, IPublishedMediaCache, INavigableDa
return GetSingleByXPath(iterator);
}
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override IEnumerable<IPublishedContent> GetByXPath(bool preview, string xpath, XPathVariable[] vars)
{
XPathNavigator navigator = CreateNavigator(preview);

View File

@@ -288,6 +288,7 @@ internal class Property : PublishedPropertyBase
return value;
}
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public override object? GetXPathValue(string? culture = null, string? segment = null)
{
_content.VariationContextAccessor.ContextualizeVariation(_variations, _content.Id, ref culture, ref segment);

View File

@@ -533,6 +533,7 @@ public class EntityController : UmbracoAuthorizedJsonController
/// <param name="type"></param>
/// <param name="parentId"></param>
/// <returns></returns>
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public ActionResult<EntityBasic?>? GetByXPath(string query, int nodeContextId, int? parentId, UmbracoEntityTypes type)
{
if (type != UmbracoEntityTypes.Document)

View File

@@ -174,6 +174,7 @@ public class UmbracoHelper
private IPublishedContent? ContentForObject(object id) => _publishedContentQuery.Content(id);
[Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IPublishedContent? ContentSingleAtXPath(string xpath, params XPathVariable[] vars) =>
_publishedContentQuery.ContentSingleAtXPath(xpath, vars);
@@ -286,9 +287,11 @@ public class UmbracoHelper
/// <remarks>If an identifier does not match an existing content, it will be missing in the returned value.</remarks>
public IEnumerable<IPublishedContent> Content(IEnumerable<int> ids) => _publishedContentQuery.Content(ids);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> ContentAtXPath(string xpath, params XPathVariable[] vars) =>
_publishedContentQuery.ContentAtXPath(xpath, vars);
[Obsolete("The current implementation of this method is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")]
public IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars) =>
_publishedContentQuery.ContentAtXPath(xpath, vars);