Пример #1
0
 public void CheckXMLfiles()
 {
     foreach (string item in XMLfiles)
     {
         XmlSchemaSet schemaSet = new XmlSchemaSet();
         schemaSet.Add(null, "XSD/" + item.Substring(0, 2) + ".xsd");
         ValidationShema.ValidateAgainstSchema(import_MO_dir + CurFiles + "/" + item, schemaSet);
         LogXML.SaveXmlLog(Path.GetFileNameWithoutExtension(item)).Save("Xml_report/" + CurFiles + "/" + item);
         setLog(item.Substring(0, 2));
         File.Delete(import_MO_dir + CurFiles + "/" + item);
     }
 }
Пример #2
0
        public static void CheckMyFile(string xsd, string xml)
        {
            XmlSchemaSet myschema = new XmlSchemaSet();

            try
            {
                myschema.Add(null, xsd);
                ValidationShema.ValidateAgainstSchema(xml, myschema);
                LogXML.SaveXmlLog(Path.GetFileNameWithoutExtension(xml)).Save("Xml_report/" + Path.GetFileName(xml));
                Process.Start("explorer.exe", Path.GetDirectoryName(Application.ExecutablePath) + @"\Xml_report");
            }
            catch (Exception e)
            {
                CheckImportMOXML.setLog("Неверный файл XSD-схемы!\n" + e.Message);
            }
        }