mirror of
				https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
				synced 2025-10-31 02:05:33 +00:00 
			
		
		
		
	Added Classes for detecting Root Elements of Hamann-Collections
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| namespace HaWeb.Settings; | ||||
| using HaWeb.Settings.XMLRoots; | ||||
|  | ||||
| public static class General { | ||||
|     // Classes generated by parsing the XML: | ||||
|   | ||||
							
								
								
									
										36
									
								
								HaWeb/Settings/XMLRoots/CommentRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								HaWeb/Settings/XMLRoots/CommentRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class CommentRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Register"; | ||||
|     public string Container { get; } = "kommcat"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "kommentar") return true; | ||||
|         else return false; | ||||
|     }; | ||||
|  | ||||
|     public Func<XElement, string?> GetKey { get; } = (elem) => {  | ||||
|         var index = elem.Attribute("id"); | ||||
|         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) { | ||||
|         var kat = element.Attribute("value"); | ||||
|         if (kat != null && !String.IsNullOrWhiteSpace(kat.Value))  | ||||
|             return (null, kat.Value); | ||||
|         return (null, Container); | ||||
|     } | ||||
|  | ||||
|     public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										33
									
								
								HaWeb/Settings/XMLRoots/DescriptionsRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								HaWeb/Settings/XMLRoots/DescriptionsRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Metadaten"; | ||||
|     public string Container { get; } = "descriptions"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "letterDesc") return true; | ||||
|         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; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										33
									
								
								HaWeb/Settings/XMLRoots/DocumentRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								HaWeb/Settings/XMLRoots/DocumentRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class DocumentRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Brieftext"; | ||||
|     public string Container { get; } = "document"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "letterText") return true; | ||||
|         else return false; | ||||
|     }; | ||||
|  | ||||
|     public 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; | ||||
|     } | ||||
|  | ||||
|     public (string?, string) GenerateIdentificationString(XElement element) { | ||||
|         return (null, Container); | ||||
|     } | ||||
|  | ||||
|     public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										33
									
								
								HaWeb/Settings/XMLRoots/EditsRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								HaWeb/Settings/XMLRoots/EditsRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class EditsRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Texteingriffe"; | ||||
|     public string Container { get; } = "edits"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "editreason") return true; | ||||
|         else return false; | ||||
|     }; | ||||
|  | ||||
|     public 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; | ||||
|     } | ||||
|  | ||||
|     public (string?, string) GenerateIdentificationString(XElement element) { | ||||
|         return (null, Container); | ||||
|     } | ||||
|  | ||||
|     public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										33
									
								
								HaWeb/Settings/XMLRoots/MarginalsRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								HaWeb/Settings/XMLRoots/MarginalsRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Stellenkommentar"; | ||||
|     public string Container { get; } = "marginalien"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "marginal") return true; | ||||
|         else return false; | ||||
|     }; | ||||
|  | ||||
|     public 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; | ||||
|     } | ||||
|  | ||||
|     public (string?, string) GenerateIdentificationString(XElement element) { | ||||
|         return (null, Container); | ||||
|     } | ||||
|  | ||||
|     public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										31
									
								
								HaWeb/Settings/XMLRoots/ReferencesRoot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								HaWeb/Settings/XMLRoots/ReferencesRoot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| namespace HaWeb.Settings.XMLRoots; | ||||
| using System.Xml.Linq; | ||||
| using HaWeb.XMLParser; | ||||
|  | ||||
| public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot { | ||||
|     public string Type { get; } = "Personen / Orte"; | ||||
|     public string Container { get; } = "definitions"; | ||||
|  | ||||
|     public Predicate<XElement> IsCollectedObject { get; } = (elem) => { | ||||
|         if (elem.Name == "personDefs" || elem.Name == "structureDefs" || elem.Name == "handDefs" || elem.Name == "locationDefs") | ||||
|             return true; | ||||
|         return false; | ||||
|     }; | ||||
|  | ||||
|     public Func<XElement, string?> GetKey { get; } = (elem) => {  | ||||
|         return elem.Name.ToString(); | ||||
|     }; | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										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
	 schnulller
					schnulller