Search code examples
.netvalidationxsdxmlreader

In .NET, does the entire XML blob come into memory when I validate against a XSD?


If I have a large (>500MB) XML file to validate, does an XmlReader bring the whole thing into memory to perform validation?

I looked at Validating an XML against referenced XSD in C# for validation procedure.

thanks, Mark


Solution

  • No, if you use XmlValidatingReader (or XmlReader with appropriate settings) it won't load the whole XML file. The method described in the question uses XmlDocument class which does load the whole file. The accepted answer doesn't load the entire file so you'll be fine using it.