Be more tolerant with Xml cache document

This commit is contained in:
Stephan
2016-12-02 11:53:37 +01:00
parent de1da4b060
commit 22397ded9b

View File

@@ -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<XmlElement>())
{
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<XmlElement>())
{
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<XmlElement>())
{
var child = childNode as XmlElement;
if (child == null) continue; // be safe
var noNode = UseLegacySchema
? child.Name != "node"
: child.GetAttributeNode("isDoc") == null;