mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 17:55:32 +00:00
Formatted everything; completed upload capabilities
This commit is contained in:
@@ -6,8 +6,7 @@ using System.Xml;
|
||||
|
||||
public static class XDocumentFileHelper {
|
||||
|
||||
private readonly static XmlReaderSettings _Settings = new XmlReaderSettings()
|
||||
{
|
||||
private readonly static XmlReaderSettings _Settings = new XmlReaderSettings() {
|
||||
CloseInput = true,
|
||||
CheckCharacters = false,
|
||||
ConformanceLevel = ConformanceLevel.Fragment,
|
||||
@@ -17,19 +16,14 @@ public static class XDocumentFileHelper {
|
||||
};
|
||||
|
||||
public static async Task<XDocument?> ProcessStreamedFile(byte[] bytes, ModelStateDictionary modelState) {
|
||||
try
|
||||
{
|
||||
using (var stream = new MemoryStream(bytes))
|
||||
{
|
||||
using (var xmlreader = XmlReader.Create(stream, _Settings))
|
||||
{
|
||||
try {
|
||||
using (var stream = new MemoryStream(bytes)) {
|
||||
using (var xmlreader = XmlReader.Create(stream, _Settings)) {
|
||||
return XDocument.Load(xmlreader, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
} catch (Exception ex) {
|
||||
modelState.AddModelError("Error", $"Kein gültiges XML-Dokument geladen. Error: {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user