From 22397ded9ba91bdf7ae11ccae6eb7f61608f7b8b Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 2 Dec 2016 11:53:37 +0100 Subject: [PATCH] Be more tolerant with Xml cache document --- .../XmlPublishedCache/PublishedContentCache.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index 00782f097e..e58bc73b25 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -179,7 +179,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache elt = null; var min = int.MaxValue; - foreach (XmlElement e in xml.DocumentElement.ChildNodes) + foreach (var e in xml.DocumentElement.ChildNodes.OfType()) { var sortOrder = int.Parse(e.GetAttribute("sortOrder")); if (sortOrder < min) @@ -201,7 +201,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (hideTopLevelNode && startNodeId <= 0) { - foreach (XmlElement e in elt.ChildNodes) + foreach (var e in elt.ChildNodes.OfType()) { var id = NavigateElementRoute(e, urlParts); if (id > 0) return id; @@ -224,11 +224,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache while (found && i < urlParts.Length) { found = false; - foreach (XmlNode childNode in elt.ChildNodes) + foreach (var child in elt.ChildNodes.OfType()) { - var child = childNode as XmlElement; - if (child == null) continue; // be safe - var noNode = UseLegacySchema ? child.Name != "node" : child.GetAttributeNode("isDoc") == null;