I’m using the XDocument.Validate extension method to validate my instance. Is there anyway to hold an XML instance accountable to its own schema reference? This seems like something that would be fairly implicit. Unfortunately simply loading the instance into an XDocument doesn’t seem to perform this validation implicitly.
I’m using the XDocument.Validate extension method to validate my instance. Is there anyway to
Share
If you want to validate on load try to use:
XDocument.Load Method (XmlReader, LoadOptions)
with validating XMLReader.
For example, something like this: