mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 17:25:32 +00:00
Repaired Bugs in File-Upload. Basic Structure for loading File-Lists
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
namespace HaWeb.XMLParser;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
|
||||
public interface IXMLRoot {
|
||||
// Name of the IXMLRoot
|
||||
public abstract string Type { get; }
|
||||
|
||||
// Tag Name of the Container
|
||||
public abstract string Container { 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; }
|
||||
@@ -14,20 +18,27 @@ public interface IXMLRoot {
|
||||
// Gets the Key of a collected object
|
||||
public abstract Func<XElement, string?> GetKey { get; }
|
||||
|
||||
// Is the pesented XElement such a root?
|
||||
public bool IsTypeOf(XElement xelement) {
|
||||
if (xelement.Name == this.Container) return true;
|
||||
return false;
|
||||
// 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>();
|
||||
ret.AddRange(elements);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Generate certain metadat fields to display about this root
|
||||
public abstract List<(string, string)>? GenerateFields(XMLRootDocument document);
|
||||
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);
|
||||
public abstract (string?, string?) GenerateIdentificationString(XElement element);
|
||||
|
||||
// Further deciding which of two documents replaces which
|
||||
public abstract bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2);
|
||||
@@ -44,4 +55,6 @@ public interface IXMLRoot {
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
public abstract XElement CreateHamannDocument(XElement element);
|
||||
}
|
||||
Reference in New Issue
Block a user