MSDN Documentation

XmlSchemaIntegrityValidationWarning Class

Namespace: System.Xml

Assembly: System.Xml.dll

Syntax

public sealed class XmlSchemaIntegrityValidationWarning

Summary

The XmlSchemaIntegrityValidationWarning class represents a warning that occurs when an XML schema integrity validation detects potential issues that do not prevent processing but may affect data quality.

Members

Properties
  • public string Message { get; } – Description of the warning.
  • public int LineNumber { get; } – Line number where the warning occurred.
  • public int LinePosition { get; } – Character position within the line.
  • public XmlSeverityType Severity { get; } – Severity level (Warning or Error).
Methods
  • public override string ToString() – Returns a string representation of the warning.

Example

using System;
using System.Xml;
using System.Xml.Schema;

class Demo
{
    static void Main()
    {
        var settings = new XmlReaderSettings();
        settings.ValidationType = ValidationType.Schema;
        settings.ValidationEventHandler += (s, e) =>
        {
            if (e.Severity == XmlSeverityType.Warning)
                Console.WriteLine($"Warning: {e.Message}");
        };

        using (var reader = XmlReader.Create("sample.xml", settings))
        {
            while (reader.Read()) { }
        }
    }
}

See Also