mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
CMIF implementiert
This commit is contained in:
@@ -8,6 +8,7 @@ namespace HaDocument.Models {
|
||||
public string? Surname { get; }
|
||||
public string? Komm { get; }
|
||||
public string? Reference { get; }
|
||||
public bool IsOrg { get; } = false;
|
||||
public XElement? XElement { get; }
|
||||
|
||||
public Person(
|
||||
@@ -17,7 +18,8 @@ namespace HaDocument.Models {
|
||||
string? surname,
|
||||
string? komm,
|
||||
string? reference,
|
||||
XElement? xElement = null
|
||||
XElement? xElement = null,
|
||||
bool IsOrg = false
|
||||
) {
|
||||
Index = index;
|
||||
Name = name;
|
||||
@@ -25,11 +27,14 @@ namespace HaDocument.Models {
|
||||
Surname = surname;
|
||||
Komm = komm;
|
||||
Reference = reference;
|
||||
this.XElement = xElement;
|
||||
this.IsOrg = IsOrg;
|
||||
}
|
||||
|
||||
public static Person? FromXElement(XElement element) {
|
||||
if (!element.HasAttributes || (element.Name != "personDef" && element.Name != "handDef")) return null;
|
||||
if (element.Attribute("index")?.Value == null || element.Attribute("name")?.Value == null) return null;
|
||||
var org = element.HasAttributes && element.Attribute("org")?.Value == "true";
|
||||
return new Person(
|
||||
element.Attribute("index")!.Value,
|
||||
element.Attribute("name")!.Value,
|
||||
@@ -37,8 +42,9 @@ namespace HaDocument.Models {
|
||||
element.Attribute("nachname")?.Value,
|
||||
element.Attribute("komm")?.Value,
|
||||
element.Attribute("ref")?.Value,
|
||||
element
|
||||
element,
|
||||
org
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user