A lot of stuff related to parsing; index page input validation

This commit is contained in:
Simon Martens
2023-09-17 15:29:51 +02:00
parent d86d508786
commit b15ce8793c
23 changed files with 294 additions and 60 deletions

View File

@@ -1,10 +1,14 @@
namespace HaWeb.Settings.XMLCollections;
using HaWeb.Models;
using System.Xml.Linq;
using HaWeb.Models;
public class EditCollection : HaWeb.XMLParser.IXMLCollection {
public string Key { get; } = "edits";
public string[] xPath { get; } = new string[] { "/opus/edits/editreason", "/opus/data/edits/editreason" };
public string[] xPath { get; } = new string[] {
"/opus/data/document/letterText//edit",
"/opus/document/letterText//edit",
"/opus/data/traditions/letterTradition//edit",
"/opus/traditions/letterTradition//edit"
};
public Func<XElement, string?> GenerateKey { get; } = GetKey;
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
@@ -13,7 +17,7 @@ public class EditCollection : HaWeb.XMLParser.IXMLCollection {
public bool Searchable { get; } = true;
public static Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
var index = elem.Attribute("ref");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;
else return null;