I am validating and Xdocument to and xsd file and everything works fine, but when I add the Xsd file to the XmlSchemaSet object it takes like one minute and a half to load, the schema is not small but only occupies 50kb which in my opinion shouldn't take that much to load. I have tried with other smaller xsd files and load in 1ms. Also tried as an embedding resource with same results. Do I have something wrong or is there a way to have the Xmlschemaset loaded somehow as a class so it doesn't loads every time, any help will be greatly appreciated.
Here is the code
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add(null, "c:\\temp\\GT_Documento-0.2.0.xsd");
XDocument xml = XDocument.Load("c:\\temp\\xmlinvoice.xml");
xml.Validate(schemaSet, ValidationCallback);
Xsd link:
https://github.com/fel-sat-gob-gt/cat/blob/desa/xsd/GT_Documento-0.2.0.xsd
The schema imports a schema document from the W3C web site at
http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
W3C actively discourage you from making operational access to such resources because they can't handle the traffic; so they impose an artificial 30-second delay on the request. You need to make a local copy of this resource and adjust your validation to pick up the local copy, either by changing the schemaLocation, or by using some kind of resolver to redirect the request.