Use extension methods in GetPersonFromXmlNode

This commit is contained in:
Patrick Barron 2023-10-06 16:43:50 -04:00
parent 1d0ecd3188
commit 1dd6442e89

View File

@ -122,16 +122,11 @@ public static class XmlReaderExtensions
{ {
case "name": case "name":
case "Name": case "Name":
name = subtree.ReadElementContentAsString(); name = subtree.ReadNormalizedString();
break; break;
case "role": case "role":
case "Role": case "Role":
var roleValue = subtree.ReadElementContentAsString(); role = subtree.ReadNormalizedString();
if (!string.IsNullOrWhiteSpace(roleValue))
{
role = roleValue;
}
break; break;
case "type": case "type":
case "Type": case "Type":
@ -140,23 +135,14 @@ public static class XmlReaderExtensions
case "order": case "order":
case "sortorder": case "sortorder":
case "SortOrder": case "SortOrder":
if (int.TryParse( if (subtree.TryReadInt(out var sortOrderVal))
subtree.ReadElementContentAsString(),
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var intVal))
{ {
sortOrder = intVal; sortOrder = sortOrderVal;
} }
break; break;
case "thumb": case "thumb":
var thumb = subtree.ReadElementContentAsString(); imageUrl = subtree.ReadNormalizedString();
if (!string.IsNullOrWhiteSpace(thumb))
{
imageUrl = thumb;
}
break; break;
default: default:
subtree.Skip(); subtree.Skip();