Added generic collections of objects. TODO: deserialization of metadata

This commit is contained in:
schnulller
2022-06-19 23:20:35 +02:00
parent d8a4fe7790
commit ba3d63ffba
17 changed files with 175 additions and 75 deletions

View File

@@ -7,13 +7,17 @@ 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?> KeyFunc, bool Searchable)[]? XPathCollection { get; } = {
("marginals", "/data/marginalien/marginal", GetKey, true),
("marginals", "/marginalien/marginal", GetKey, true)
};
public Predicate<XElement> IsCollectedObject { get; } = (elem) => {
if (elem.Name == "marginal") return true;
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public static Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;