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.Xml.Schema;
2using Waher.Events;
3
4namespace Waher.Content.Xsl
5{
9 internal class XmlValidator
10 {
11 private readonly string objectId = null;
12 private XmlSchemaException exception;
13
14 public XmlValidator(string ObjectID)
15 {
16 this.objectId = ObjectID;
17 this.exception = null;
18 }
19
20 internal void ValidationCallback(object Sender, ValidationEventArgs e)
21 {
22 switch (e.Severity)
23 {
24 case XmlSeverityType.Error:
25 this.exception = e.Exception;
26 break;
27
28 case XmlSeverityType.Warning:
29 if (!string.IsNullOrEmpty(this.objectId))
30 Log.Warning(e.Message, this.objectId);
31 break;
32 }
33 }
34
35 internal XmlSchemaException Exception => this.exception;
36 internal bool HasError { get { return !(this.exception is null); } }
37
38 internal void AssertNoError()
39 {
40 if (!(this.exception is null))
41 throw this.exception;
42 }
43 }
44
45}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
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:576