/// <summary> /// Validates the and load XML document. /// </summary> /// <param name="path">The path.</param> /// <returns></returns> private static XElement ValidateAndLoadXmlDocument(string path) { var validator = new XmlValidator(); using (StreamReader sr = File.OpenText(path)) { string xmlContent = sr.ReadToEnd(); using (Stream schemaStream = typeof(XmlDocumentationLoader).Assembly.GetManifestResourceStream( "ParaEngine.NPLLanguageService.Documentation.LuaDoc.xsd")) { if (validator.Validate(xmlContent, schemaStream)) { return(XElement.Load(path)); } throw new ApplicationException(validator.ErrorMessage); } } }
/// <summary> /// Validates the and load XML document. /// </summary> /// <param name="path">The path.</param> /// <returns></returns> private static XElement ValidateAndLoadXmlDocument(string path) { var validator = new XmlValidator(); using (StreamReader sr=File.OpenText(path)) { string xmlContent = sr.ReadToEnd(); using(Stream schemaStream=typeof (XmlDocumentationLoader).Assembly.GetManifestResourceStream( "ParaEngine.NPLLanguageService.Documentation.LuaDoc.xsd")) { if (validator.Validate(xmlContent, schemaStream)) return XElement.Load(path); throw new ApplicationException(validator.ErrorMessage); } } }