mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
Added Classes for detecting Root Elements of Hamann-Collections
This commit is contained in:
33
HaWeb/Settings/XMLRoots/TraditionsRoot.cs
Normal file
33
HaWeb/Settings/XMLRoots/TraditionsRoot.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace HaWeb.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
using HaWeb.XMLParser;
|
||||
|
||||
public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public string Type { get; } = "Überlieferung";
|
||||
public string Container { get; } = "traditions";
|
||||
|
||||
public Predicate<XElement> IsCollectedObject { get; } = (elem) => {
|
||||
if (elem.Name == "letterTradition") return true;
|
||||
else return false;
|
||||
};
|
||||
|
||||
public Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("ref");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public (string?, string) GenerateIdentificationString(XElement element) {
|
||||
return (null, Container);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user