public void Validate_XmlNotSelected() { dialogService .Setup(x => x.AskForFiles(It.IsAny <bool>(), FileType.Xml)) .Returns(Array.Empty <string>()); validator.Validate(app.Object); dialogService.VerifyAll(); }
public ActionResult SaveXmlListTest(TestListRedactorView view) { if (view.Ids != null) { foreach (var id in view.Ids) { view._XmlModel.Options.Single(x => x.Id == id).IsTrue = true; } } if (!XmlValidator.Validate(view._XmlModel)) { ViewBag.Errors = XmlValidator.ErrorList; view.Question = cx.Questions.Find(view.Question.Id); return(PartialView("Redactor", view)); } view = (TestListRedactorView)helper.SaveXmlQuestion(view); ViewBag.IsSaved = true; return(PartialView("Redactor", view)); }
public void DivideProblemMessageSerializationTest() { byte[] byteArray = Encoding.UTF8.GetBytes("Test Byte Array"); var divideProblemMessageMessage = new DivideProblemMessage("Problem Type", 123L, byteArray, 321L); var result = divideProblemMessageMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "DivideProblemMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<DivideProblem xmlns="http://www.mini.pw.edu.pl/ucc/"> // <ProblemType>Problem Type</ProblemType> // <Id>123</Id> // <Data>VGVzdCBCeXRlIEFycmF5</Data> // <ComputationalNodes>321</ComputationalNodes> //</DivideProblem> #endregion }
public void XmlValidatorCorrectXmlTest() { var validator = new XmlValidator(); var validationResult = validator.Validate(@"..\..\Task1\Content\books.xml", @"Task1\Content\BooksScheme.xsd", "http://library.by/catalog"); Assert.IsTrue(validationResult); }
/// <summary> /// Gets a list of semantic diagnostic marks for the provided script file /// </summary> /// <param name="scriptFile"></param> internal List <Diagnostic> GetSemanticMarkers(ScriptFile scriptFile) { List <Diagnostic> markers = new List <Diagnostic>(); XmlValidator xmlValidator = new XmlValidator(); if (xmlValidator.Validate(new Uri(scriptFile.FilePath), scriptFile.Contents) == false) { foreach (XmlError xmlError in xmlValidator.Errors) { markers.Add(new Diagnostic() { Code = xmlError.ErrorCode.ToString(), Message = xmlError.Message, Range = new Range() { Start = new Position() { Character = xmlError.Column, Line = xmlError.Line }, End = new Position() { Character = xmlError.Column, Line = xmlError.Line } }, Severity = DiagnosticSeverity.Error, Source = "xml" }); } } return(markers); }
public void RegisterMessageSerializationTest() { var problemList = new List <string>() { "DVRP" }; var registerMessage = new RegisterMessage(EComponentType.TaskManager, 1, problemList); var result = registerMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "RegisterMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<Register xmlns="http://www.mini.pw.edu.pl/ucc/"> // <Type>TaskManager</Type> // <SolvableProblems> // <ProblemName>DVRP</ProblemName> // </SolvableProblems> // <ParallelThreads>1</ParallelThreads> //</Register> #endregion }
public void should_produce_a_valid_xml() { var xmlValidator = new XmlValidator(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SchemaSpecs.xsd"), NameSpace); var validationResult = xmlValidator.Validate(_result.ToString()); validationResult.Success.ShouldBeTrue(validationResult.FullMessageLog); }
public void SolveRequestMessageSerializationTest() { byte[] byteArray = Encoding.UTF8.GetBytes("Test Byte Array"); var solveRequestMessage = new SolveRequestMessage("Problem Type", 122L, byteArray); var result = solveRequestMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "SolveRequestMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<SolveRequest xmlns="http://www.mini.pw.edu.pl/ucc/"> // <ProblemType>Problem Type</ProblemType> // <SolvingTimeout>122</SolvingTimeout> // <Data>VGVzdCBCeXRlIEFycmF5</Data> //</SolveRequest> #endregion }
protected override async Task <bool> ValidateCatalogStreamAsync(Stream inputStream) { var schemeStream = Resources.UpdateValidator.ToStream(); var validator = new XmlValidator(schemeStream); return(await Task.FromResult(validator.Validate(inputStream))); }
public void RegisterResponseMessageSerializationTest() { var registerResponseMessage = new RegisterResponseMessage(123123123L, DateTime.Now); var result = registerResponseMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "RegisterResponseMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<RegisterResponse xmlns="http://www.mini.pw.edu.pl/ucc/"> // <Id>123123123</Id> // <Timeout>2014-03-07T23:25:05.0728496+01:00</Timeout> //</RegisterResponse> #endregion }
public void should_be_able_to_match_the_predefined_schema() { var xmlValidator = new XmlValidator(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SchemaSpecs.xsd"), NameSpace); var validationResult = xmlValidator.Validate(_xmlToDeserialize.ToString()); validationResult.Success.ShouldBeTrue(validationResult.FullMessageLog); }
internal static void ShowXmlEditor(Form1 form) { CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(form.pagesTabControl.SelectedTabPage); if (String.IsNullOrEmpty(pageTextBox.Text)) { ShowInfoBox(form, LanguageUtil.GetCurrentLanguageString("TextEmpty", className)); return; } String error; if (!XmlValidator.Validate(form, false, ValidationType.Schema, null, out error)) { ShowAlertBox(form, error); return; } XmlEditor fileRename = new XmlEditor { Owner = form }; fileRename.InitializeForm(); fileRename.Show(form); }
internal static void FormatXml(Form1 form, bool validationFirst = true, bool indentation = true) { XtraTabControl pagesTabControl = form.pagesTabControl; CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage); if (validationFirst && !XmlValidator.Validate(form, ValidationType.Schema, false)) { return; } int indentationNum = indentation ? 1 : 0; XmlDocument xd = new XmlDocument(); xd.LoadXml(pageTextBox.Text); //xd.LoadXml(EncodeHTMLTagsForXMLValidation(pageTextBox.Text)); StringBuilder builder = new StringBuilder(); using (StringWriter writer = new StringWriter(builder)) { using (XmlTextWriter xtw = new XmlTextWriter(writer)) { xtw.IndentChar = '\t'; xtw.Indentation = indentationNum; xtw.Formatting = Formatting.Indented; xd.WriteTo(xtw); } pageTextBox.SelectAll(); pageTextBox.SelectedText = builder.ToString(); //pageTextBox.SelectedText = DecodeHTMLTagsForXMLValidation(builder.ToString()); TextManager.RefreshUndoRedoExternal(form); } }
static void Main(string[] args) { var validator = new XmlValidator(); var result = validator.Validate(@"<?xml version=""1.0""?> <Product ProductID=""1"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:noNamespaceSchemaLocation=""schema.xsd""> <ProductName>Chairs</ProductName> </Product>"); }
private void Validate(string content) { var result = _xmlValidator.Validate(content); if (!result.IsValid) { throw new XmlSchemaValidationException(result.ToString()); } }
public void Test_Validate_ValidXml_ShouldReturnTrue() { var validator = new XmlValidator(); var success = validator.Validate("books_valid.xml", (lineNumber, linePosition, message) => { Console.WriteLine($"[{lineNumber}:{linePosition}] {message}"); }); Assert.AreEqual(true, success); }
/// <summary> /// Loads a context by interpreting the specified document. The specified arguments will be properties in the context. /// </summary> /// <param name="xDocument">The document that is interpreted.</param> /// <param name="arguments">Initial properties.</param> /// <returns>The loaded context.</returns> public static RIContext Parse(XDocument xDocument, IDictionary <string, object> arguments = null) { var validator = new XmlValidator("context.xsd", "Runerne.Instantiation.Xml", Assembly.GetExecutingAssembly()); validator.Validate(xDocument); var xRoot = xDocument.Root; var context = Parse(xRoot, arguments); return(context); }
public void ValidateIncorrectFile() { var testXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><testElement xmlns=\"http://tempuri.org/XMLSchema.xsd\"><element1>element11</element1><element2>aaaa</element2></testElement>"; var testXsd = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xs:schema targetNamespace=\"http://tempuri.org/XMLSchema.xsd\" elementFormDefault=\"qualified\" xmlns=\"http://tempuri.org/XMLSchema.xsd\" xmlns:mstns=\"http://tempuri.org/XMLSchema.xsd\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><xs:element name=\"testElement\"><xs:complexType><xs:sequence><xs:element name=\"element1\" type=\"xs:string\"/><xs:element name=\"element2\" type=\"xs:integer\"/></xs:sequence></xs:complexType></xs:element></xs:schema>"; var xmlValidator = new XmlValidator(); var result = xmlValidator.Validate(testXml, testXsd, false); var errorsCount = result.Errors.Count + result.Warnings.Count; Assert.AreNotEqual(errorsCount, 0); }
public void XmlValidatorIncorrectXmlTest() { var validator = new XmlValidator(); var validationResult = validator.Validate(@"..\..\Task1\Content\booksWithErrors.xml", @"Task1\Content\BooksScheme.xsd", "http://library.by/catalog"); Assert.IsFalse(validationResult); foreach (var error in validator.Errors) { Console.WriteLine(error); } }
public void SolutionsMessageSerializationTest() { byte[] byteArray = Encoding.UTF8.GetBytes("Test Byte Array"); Solution solution = new Solution { ComputationsTime = 122L, Data = byteArray, SolutionType = ESolutionType.Final, TaskId = 123L, TimeoutOccured = true }; List <Solution> solutions = new List <Solution>(); solutions.Add(solution); var solutionsMessage = new SolutionsMessage("Problem Type", 123L, byteArray, solutions); var result = solutionsMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "SolutionsMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<Solutions xmlns="http://www.mini.pw.edu.pl/ucc/"> // <ProblemType>Problem Type</ProblemType> // <Id>123</Id> // <CommonData>VGVzdCBCeXRlIEFycmF5</CommonData> // <Solutions> // <Solution> // <TaskId>123</TaskId> // <TimeoutOccured>true</TimeoutOccured> // <Type>Final</Type> // <ComputationsTime>00:00:00</ComputationsTime> // <Data>VGVzdCBCeXRlIEFycmF5</Data> // </Solution> // </Solutions> //</Solutions> #endregion }
/// <summary> /// Receive and process block of string containing xml data. /// </summary> /// <param name="value"></param> /// <returns></returns> public IHttpActionResult Post([FromBody] string value) { if (!XmlValidator.Validate(value)) { return(BadRequest("Invalid XML form!")); } Guid rowId = Guid.Empty; using (VendorReservationRepository repo = new VendorReservationRepository()) { rowId = repo.ProcessXMLData(value); } return(Ok <string>("Well done!")); }
internal static void ConvertHtmlToText(Form1 form) { XtraTabControl pagesTabControl = form.pagesTabControl; CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage); String error; if (!XmlValidator.Validate(form, false, ValidationType.Schema, null, out error)) { WindowManager.ShowAlertBox(form, error); return; } FormatManager.FormatXml(form, false, false); String text = ConstantUtil.HtmlTags.Aggregate(pageTextBox.Text, (current, keyValuePair) => current.Replace(keyValuePair.Value, keyValuePair.Value == " " ? " " : keyValuePair.Key)); //String text = pageTextBox.Text; //foreach (KeyValuePair<String, String> keyValuePair in ConstantUtil.HtmlTags) //Tags //{ // text = text.Replace(keyValuePair.Value, keyValuePair.Value == " " ? " " : keyValuePair.Key); //} //HTML head text = text.Substring(text.IndexOf("<body>") + 6); //HTML lists tags text = text.Replace("<ul>", String.Empty).Replace("</ul>", String.Empty).Replace("<li>", "- ").Replace("<ol>", "- ").Replace("</li>", String.Empty); //Other HTML tags int startIndex = text.IndexOf("<"); while (startIndex != -1) { int endIndex = text.IndexOf(">", startIndex) + 1; text = text.Remove(startIndex, endIndex - startIndex); startIndex = text.IndexOf("<"); } pageTextBox.SelectAll(); pageTextBox.SelectedText = text; pageTextBox.SelectAll(); TextManager.OutdentSelectedLines(form); TextManager.OutdentSelectedLines(form); TextManager.RefreshUndoRedoExternal(form); }
/// <summary> /// --- Load example -> M System description - Click event --- /// Opens OpenFileDialog, M System description file and deserialize input. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event parameter.</param> private void mSystemDescriptionToolStripMenuItem_Click(object sender, EventArgs e) { try { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "XML Files (.xml)|*.xml"; openFileDialog.Multiselect = false; if (openFileDialog.ShowDialog() == DialogResult.OK) { //Check if selected file is really evolution file. XDocument doc = XDocument.Load(openFileDialog.FileName); if (doc.Element("root") == null) { throw new InvalidOperationException("Selected file is not an M System description file."); } v_MSystemObjectsPath = openFileDialog.FileName; //XSD validation if (v_ValidateUsingXSD) { string errorsAndWarnings; if (!XmlValidator.Validate(v_MSystemObjectsPath, v_XSDPath, out errorsAndWarnings)) { throw new ValidationFailed(errorsAndWarnings); } } string errorMessage; IDeserializedObjects deserializedObjects = Xmlizer.Deserialize(v_MSystemObjectsPath, out errorMessage); if (deserializedObjects == null) { richTextBoxMSystem.Text = errorMessage; return; } v_MSystemObjects = TypeUtil.Cast <DeserializedObjects>(deserializedObjects); RestartSimulator(); richTextBoxMSystem.Text = v_Simulator.MSystemToString(); VisualizeLogging.LogMessageAndVisualize("Deserialization of M System description file was successful."); VisualizeLogging.LogMessageAndVisualize(string.Format("File: {0}", openFileDialog.FileName)); } } catch (Exception exception) { ExceptionWindow.Show(exception); } }
public ActionResult SaveXmlTextInput(TestTextInputRedactorView view) { if (!XmlValidator.Validate(view._XmlModel)) { ViewBag.Errors = XmlValidator.ErrorList; view.Question = cx.Questions.Find(view.Question.Id); return(PartialView("Redactor", view)); } view = (TestTextInputRedactorView)helper.SaveXmlQuestion(view); ViewBag.IsSaved = true; return(PartialView("Redactor", view)); }
public void SolvePartialProblemsSerializationTest() { byte[] byteArray = Encoding.UTF8.GetBytes("Test Byte Array"); PartialProblem partialProblem = new PartialProblem { Data = byteArray, TaskId = 123L, }; List <PartialProblem> partialProblems = new List <PartialProblem>(); partialProblems.Add(partialProblem); var partialProblemsMessage = new SolvePartialProblemsMessage("Problem Type", 123L, byteArray, 122L, partialProblems); var result = partialProblemsMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "SolvePartialProblems.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<PartialProblems xmlns="http://www.mini.pw.edu.pl/ucc/"> // <ProblemType>Problem Type</ProblemType> // <Id>123</Id> // <CommonData>VGVzdCBCeXRlIEFycmF5</CommonData> // <SolvingTimeout>122L</SolvingTimeout> // <PartialProblems> // <PartialProblem> // <TaskId>123</TaskId> // <Data>VGVzdCBCeXRlIEFycmF5</Data> // </PartialProblem> // </PartialProblems> //</PartialProblems> #endregion }
public void StatusMessageSerializationTest() { IOThread ioThread = new IOThread { State = EState.Busy, ProblemInstanceId = 123L, ProblemType = "ProblemType", TaskId = 321L }; var threadList = new List <IOThread>(); threadList.Add(ioThread); var registerStatusMessage = new StatusMessage(123L, threadList); var result = registerStatusMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "StatusMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<Status xmlns="http://www.mini.pw.edu.pl/ucc/"> // <Id>123</Id> // <Threads> // <IOThread> // <State>Busy</State> // <HowLong>00:00:00</HowLong> // <ProblemInstanceId>123</ProblemInstanceId> // <TaskId>321</TaskId> // <ProblemType>ProblemType</ProblemType> // </IOThread> // </Threads> //</Status> #endregion }
public ActionResult SaveXmlMatching(TestMatchingRedactorView view) { view._XmlModel.Answers = view.ParseAnswers(); if (!XmlValidator.Validate(view._XmlModel)) { ViewBag.Errors = XmlValidator.ErrorList; view.Question = cx.Questions.Find(view.Question.Id); return(PartialView("Redactor", view)); } view = (TestMatchingRedactorView)helper.SaveXmlQuestion(view); ViewBag.IsSaved = true; return(PartialView("Redactor", view)); }
public void SolutionRequestMessageSerializationTest() { var solutionRequestMessage = new SolutionRequestMessage(123L); var result = solutionRequestMessage.SerializeToXml(); Assert.IsNotNull(result); Assert.AreNotEqual(0, result.Length); var xmlValidator = new XmlValidator(); var xsdSchemaFile = "SolutionRequestMessage.xsd"; var xsdSchemaPath = Path.Combine(_xsdSchemasPath, xsdSchemaFile); var validationResult = xmlValidator.Validate(result, xsdSchemaPath, true); var errorsCount = validationResult.Errors.Count + validationResult.Warnings.Count; Assert.AreEqual(0, errorsCount); #region ExampleResult //<?xml version="1.0" encoding="utf-16"?> //<SolutionRequest xmlns="http://www.mini.pw.edu.pl/ucc/"> // <Id>123</Id> //</SolutionRequest> #endregion }
static void Main(string[] args) { //NAW naw1 = new NAW("ABC", "straat", "schijndel"); //NAW naw2 = new NAW("YIJD", "dropstraat", "den bosch"); //NAW naw3 = new NAW("DEF", "kerkstraat", "amsterdam"); //NAW naw4 = new NAW("DEF", "dorpstraat", "amsterdam"); //NAW naw5 = new NAW("ABC", "kerkstraat", "amsterdam"); //NAW naw6 = new NAW("ABC", "kerkstraat", "amsterdam"); //NawHashTable nawHash = new NawHashTable(10); //nawHash.Add(naw1); //nawHash.Add(naw5); //nawHash.Add(naw6); //nawHash.Add(naw2); //nawHash.Add(naw3); //nawHash.Add(naw4); String goodxml = "<child><body></body></child>"; String badxml = "<child><body></body><child>"; XmlValidator xmlValidator = new XmlValidator(); if (xmlValidator.Validate(badxml)) { Console.WriteLine("Succes!"); } else { Console.WriteLine("Fail!"); } System.Console.ReadKey(); }
/// <summary> /// Start of console application specific logic. /// </summary> protected override void Execute() { // This is where magic happens // Fetch datasett fra en kommaseparert fil, der hver linje er en correspondence DatasourceReader reader = new DatasourceReader(this.Arguments.SourceFile); reader.ReadFile(); Correspondences corrColl = new Correspondences() { SystemUserCode = ConfigurationManager.AppSettings["systemUserCode"], ShipmentReference = Guid.NewGuid().ToString(), SequenceNo = null, Correspondence = new CorrespondencesCorrespondence[reader.Count] }; int index = 0; // For datasettet lages en XML fil med alle correspence fra csv fila // systemUserCode hentes fra app.config foreach (CorrespondenceInput correspondence in reader.GetEnumerable()) { corrColl.Correspondence[index++] = new CorrespondencesCorrespondence() { Reportee = correspondence.Reportee, ServiceCode = this.Arguments.ServiceCode, ServiceEdition = this.Arguments.ServiceEdition, SendersReference = Guid.NewGuid().ToString(), Content = new CorrespondencesCorrespondenceContent() { LanguageCode = correspondence.LanguageCode, MessageTitle = correspondence.MessageTitle, MessageBody = correspondence.MessageBody, MessageSummary = correspondence.MessageSummary, }, VisibleDateTime = correspondence.VisibleDateTime, VisibleDateTimeSpecified = true, IsReservable = correspondence.IsReservable, IsReservableSpecified = true, }; } string destfolder = ConfigurationManager.AppSettings["localPathToFilesToUpload"]; string name = Path.GetFileName(this.Arguments.SourceFile); if (name == null) { return; } string fileName = name.Replace(".csv", ".xml"); string destfile = destfolder.Contains("*") ? destfolder.Replace("*", fileName) : Path.Combine(destfolder, fileName); // XML filene lagres på local path ihht konfigurasjonen localPathToFilesToUpload using (FileStream fileStream = File.Create(destfile)) { XmlSerializer serializer = new XmlSerializer(corrColl.GetType()); serializer.Serialize(fileStream, corrColl); } XmlValidator.Validate(destfile); try { SftpClientHelper.TransferFiles(); File.Delete(destfile); } catch (Exception) { throw; } }