mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
added basic start page setup; began rewrite of parser
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
|
||||
public interface IDocument {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
namespace HaDocument.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using HaDocument.Models;
|
||||
@@ -18,7 +18,7 @@ public interface ILibrary {
|
||||
ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
|
||||
ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
|
||||
ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
|
||||
|
||||
|
||||
ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
|
||||
Lookup<string, Comment> CommentsByCategory { get; }
|
||||
Lookup<string, Marginal> MarginalsByLetter { get; }
|
||||
|
||||
64
HaDocumentNew/Interfaces/IXMLRoot.cs
Normal file
64
HaDocumentNew/Interfaces/IXMLRoot.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using HaDocument.Models;
|
||||
|
||||
public interface IXMLRoot {
|
||||
// Name of the IXMLRoot
|
||||
public abstract string Type { get; }
|
||||
|
||||
// Name of the file prefix
|
||||
public abstract string Prefix { get; }
|
||||
|
||||
// XPaths to determine if container is present
|
||||
public abstract string[] XPathContainer { get; }
|
||||
|
||||
// Tag Name of child objects to be collected
|
||||
public abstract Predicate<XElement> IsCollectedObject { get; }
|
||||
|
||||
// Gets the Key of a collected object
|
||||
// public abstract Func<XElement, string?> GetKey { get; }
|
||||
|
||||
// Can the Root be found within that document?
|
||||
public List<XElement>? IsTypeOf(XElement root) {
|
||||
List<XElement>? ret = null;
|
||||
foreach (var p in XPathContainer) {
|
||||
var elements = root.XPathSelectElements(p);
|
||||
if (elements != null && elements.Any()) {
|
||||
if (ret == null) ret = new List<XElement>();
|
||||
foreach (var e in elements)
|
||||
if (!ret.Contains(e)) ret.Add(e);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Generate certain metadata fields to display about this root
|
||||
// public abstract List<(string, string?)>? GenerateFields(XMLRootDocument document);
|
||||
|
||||
// Generate an identification string of which the hash will be the filename.
|
||||
// The second string will be appended literally for convenience.
|
||||
// If the queries of two document are equal they replace each other
|
||||
// If the queries and the date of two documents are equal the later one gets deleted
|
||||
public abstract (string?, string?) GenerateIdentificationString(XElement element);
|
||||
|
||||
// Further deciding which of two documents replaces which
|
||||
// public abstract bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2);
|
||||
|
||||
// public Dictionary<string, XElement>? GetCollectedObjects(XMLRootDocument document) {
|
||||
// Dictionary<string, XElement>? ret = null;
|
||||
// var root = document.GetElement();
|
||||
// root.Elements().Where(x => this.IsCollectedObject(x)).ToList().ForEach(x => {
|
||||
// var id = this.GetKey(x);
|
||||
// if (id != null) {
|
||||
// if (ret == null) ret = new Dictionary<string, XElement>();
|
||||
// ret.Add(id, x);
|
||||
// }
|
||||
// });
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
public abstract XElement CreateHamannDocument(XElement element);
|
||||
|
||||
// public abstract void MergeIntoFile(XElement file, XMLRootDocument document);
|
||||
}
|
||||
Reference in New Issue
Block a user