I am trying to reacquaint myself with XML documents and schemas (XSD), but I am having trouble understanding what sort of XML document issues would yield a XmlSeverityType.Warning.
Taking this as an example, what would I need to change in the XML document (or XSD schema) to force a warning to appear?
As @Evk commented, the documentation for XmlSeverityType.Warning states:
Warning Indicates that a validation event occurred that is not an error. A warning is typically issued when there is no DTD, or XML Schema to validate a particular element or attribute against. Unlike errors, warnings do not throw an exception if there is no validation event handler.
Therefore, it's not so much what to change in your XML or XSD but what you might change to cause your XSD not to be found for your XML, i.e. perturbing (or deleting) the following line in your source:
settings.Schemas.Add("http://www.contoso.com/books", "contosoBooks.xsd");
It's possible that the .NET XSD processor has opted to present additional diagnostics beyond those required by the W3C XSD Recommendation or W3C XML Recommendation (see also valid vs well-formed), but the only change mentioned in the documentation pertains to validation request that cannot be fulfilled due to a missing schema.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With