BExIS.Xml.Helpers.Mapping.XmlMapperManager.Validate C# (CSharp) Method

Validate() public method

public Validate ( XmlDocument doc ) : string
doc System.Xml.XmlDocument
return string
        public string Validate(XmlDocument doc)
        {
            string msg = "";

            try
            {
                doc.Schemas = this.xmlSchemaManager.SchemaSet;
                doc.Validate(null);
            }
            catch (Exception ex)
            {
                return ex.Message;
            }

            return msg;
        }

Usage Example

Example #1
0
        public static string IsValideAgainstSchema(long datasetId, TransmissionType type, string mappingName)
        {
            try
            {
                DatasetManager datasetManager = new DatasetManager();
                DatasetVersion datasetVersion = datasetManager.GetDatasetLatestVersion(datasetId);

                string mappingFileName = XmlDatasetHelper.GetTransmissionInformation(datasetVersion, type, mappingName);
                string pathMappingFile = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DIM"), mappingFileName);

                XmlMapperManager xmlMapperManager = new XmlMapperManager(TransactionDirection.InternToExtern);
                xmlMapperManager.Load(pathMappingFile, "exporttest");

                XmlDocument tmp = GetConvertedMetadata(datasetId, type, mappingName, false);

                string path = Path.Combine(AppConfiguration.DataPath, "Temp", "System", "convertedMetadata.xml");

                if (FileHelper.FileExist(path))
                    FileHelper.Delete(path);

                FileHelper.CreateDicrectoriesIfNotExist(Path.GetDirectoryName(path));

                tmp.Save(path);
                XmlDocument metadataForImport = new XmlDocument();
                metadataForImport.Load(path);

                return xmlMapperManager.Validate(metadataForImport);
            }
            catch (Exception ex)
            {

                return ex.Message;
            }
        }
All Usage Examples Of BExIS.Xml.Helpers.Mapping.XmlMapperManager::Validate