Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
XmlValidator.cs
1using System;
2using System.Collections.Generic;
3using System.Xml;
4using System.Xml.Schema;
5using Waher.Events;
6
7namespace Waher.Content.Xsl
8{
12 internal class XmlValidator
13 {
14 private readonly string objectId = null;
15 private XmlSchemaException exception;
16
17 public XmlValidator(string ObjectID)
18 {
19 this.objectId = ObjectID;
20 this.exception = null;
21 }
22
23 internal void ValidationCallback(object Sender, ValidationEventArgs e)
24 {
25 switch (e.Severity)
26 {
27 case XmlSeverityType.Error:
28 this.exception = e.Exception;
29 break;
30
31 case XmlSeverityType.Warning:
32 if (!string.IsNullOrEmpty(this.objectId))
33 Log.Warning(e.Message, this.objectId);
34 break;
35 }
36 }
37
38 internal XmlSchemaException Exception => this.exception;
39 internal bool HasError { get { return !(this.exception is null); } }
40
41 internal void AssertNoError()
42 {
43 if (!(this.exception is null))
44 throw this.exception;
45 }
46 }
47
48}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:13
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
Definition: Log.cs:566