Added collection classes. Will not do extra collection for subcomments rn.

This commit is contained in:
schnulller
2022-06-26 22:48:25 +02:00
parent 056ab77888
commit 0fa0ff6a88
22 changed files with 490 additions and 226 deletions

View File

@@ -7,31 +7,12 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
public string Type { get; } = "Stellenkommentar";
public string Prefix { get; } = "stellenkommentar";
public string[] XPathContainer { get; } = { ".//data/marginalien", ".//marginalien" };
public (
string Key,
string xPath,
Func<XElement, string?> GenerateKey,
Func<XElement, Dictionary<string, string[]>?>? GenerateDataFields,
Func<List<CollectedItem>, Dictionary<string, Lookup<string, CollectedItem>>?>? GroupingsGeneration,
Func<List<CollectedItem>, Dictionary<string, List<CollectedItem>>?>? SortingsGeneration,
bool Searchable
)[]? Collections { get; } = {
("marginals", "/data/marginalien/marginal", GetKey, null, null, null, true),
("marginals", "/marginalien/marginal", GetKey, null, null, null, true)
};
public Predicate<XElement> IsCollectedObject { get; } = (elem) => {
if (elem.Name == "marginal") return true;
else return false;
};
public static Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;
else return null;
};
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null;
}