public static void ConvertOutputXmlFileToOutputFlatFile(TransformBase map, string outputXmlFilename, string outputFlatFileFilename, bool validateFlatFile)
        {
            if (map == null)
            {
                throw new ArgumentNullException(nameof(map));
            }

            ITOMErrorInfo[] creationErrors = null;

            string            targetSchemaClassName = map.TargetSchemas[0];
            CMapperSchemaTree targetSchemaTree      = BizTalkMapSchemaUtility.CreateSchemaTreeAndLoadSchema(map, targetSchemaClassName);

            if (!targetSchemaTree.CreateNativeInstanceFromXMLInstance(outputXmlFilename, outputFlatFileFilename, out creationErrors))
            {
                string message = "No details provided.";

                if (creationErrors != null)
                {
                    var messages = creationErrors.Select(e => $"Line:{e.LineNumber} Position:{e.LinePosition} {(e.IsWarning ? "Warning: " : "Error: ")} {e.ErrorInfo}");
                    message = string.Join(". " + Environment.NewLine, messages);
                }

                throw new InvalidDataException($"An error occurred while converting from XML to a flat file format: {Environment.NewLine}{message}");
            }

            if (validateFlatFile)
            {
                BizTalkXmlMapTestValidator.ValidateFlatFile(outputFlatFileFilename, targetSchemaTree, targetSchemaClassName);
            }
        }
        public static XNode ConvertInputFlatFileContentsToInputXml(TransformBase map, string inputFlatFileContents)
        {
            if (map == null)
            {
                throw new ArgumentNullException(nameof(map));
            }

            string            sourceSchemaClassName = map.SourceSchemas[0];
            CMapperSchemaTree sourceSchemaTree      = BizTalkMapSchemaUtility.CreateSchemaTreeAndLoadSchema(map, sourceSchemaClassName);
            string            convertedXml          = BizTalkXmlMapTestValidator.ValidateFlatFileContents(inputFlatFileContents, sourceSchemaTree, sourceSchemaClassName);

            return(XElement.Parse(convertedXml));
        }