private XmlNS.XmlWriter CreateXmlFile(string filePath) { var dirPath = Path.GetDirectoryName(filePath); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } var xmlWriterSettings = new XmlNS.XmlWriterSettings() { Indent = true, CheckCharacters = false }; return(XmlNS.XmlWriter.Create(filePath, xmlWriterSettings)); }