.NET API Reference

XmlSchemaIntegrityValidationWarning Enum

Namespace

System.Xml.Schema

Assembly

System.Xml.dll

Summary

Specifies the type of warning that can be raised when validating the integrity of an XML schema. These warnings do not prevent a schema from being loaded but indicate potential issues that may affect validation behavior.

Declaration

public enum XmlSchemaIntegrityValidationWarning

Members

NameValueDescription
None0No warning.
DuplicateAnnotation1Multiple <annotation> elements were found for the same component.
MissingTargetNamespace2The schema does not specify a targetNamespace.
RedundantImport3An <import> is redundant because the namespace is already included.
UnsupportedExtension4The schema uses an extension that is not recognized by the current runtime.
ConflictingVersion5Different versions of the same schema are referenced.

Example

using System;
using System.Xml.Schema;

class Program
{
    static void Main()
    {
        var schemaSet = new XmlSchemaSet();
        schemaSet.ValidationEventHandler += (sender, e) =>
        {
            if (e.Severity == XmlSeverityType.Warning)
                Console.WriteLine($""Warning: {e.Message}"");
        };
        schemaSet.Add(@"http://example.com/schema", "example.xsd");
        schemaSet.Compile();
    }
}

Remarks

When a warning of this type is encountered, the XmlSchemaSet.ValidationEventHandler is invoked with XmlSeverityType.Warning. You can decide whether to treat warnings as errors by throwing an exception within the handler.

See Also