private static ValidationResult ValidateProfileDoc(XDocument custDoc)
        {
            ValidationResult result = new ValidationResult();

            try
            {
                decimal scVer = ValidateXml.GetSchemaVersion(custDoc.Root);
                ValidateXml.ValidateVersionRange(scVer);

                string xsdMarkup = AppCommon.Instance.SchemaProfile1_1;
                //future versions when there is more then on version of schema
                //if (scVer == 1.1M)
                //{
                //    xsdMarkup = AppCommon.Instance.SchemaProfile1_1;
                //}
                //else if (scVer == 1.2M)
                //{
                //    xsdMarkup = AppCommon.Instance.SchemaProfile1_2;
                //}
                XmlSchemaSet schemas = new XmlSchemaSet();
                schemas.Add("", XmlReader.Create(new StringReader(xsdMarkup)));

                custDoc.Validate(schemas, (o, e) =>
                {
                    result.Errors.Add(e.Message);
                });
            }
            catch (Exception err)
            {
                result.Errors.Add(err.Message);
            }
            return(result);
        }
        /// <summary>
        /// Validates Plugin Xml file
        /// </summary>
        /// <param name="xmlFile">The full path to the file to validate</param>
        /// <returns>
        /// <see cref="ValidationResult"/> with <see cref="ValidationResult.HasErrors"/> True if there are errros with the xml;
        /// Othewise <see cref="ValidationResult.HasErrors"/> will be False. Any error messages will be contained in <see cref="ValidationResult.Errors"/>
        /// </returns>
        /// <remarks>Validation occrus against internal XSD file for plugin</remarks>
        public static ValidationResult ValidatePluginFile(string xmlFile)
        {
            ValidationResult result = new ValidationResult();

            if (!File.Exists(xmlFile))
            {
                result.Errors.Add(Properties.Resources.ErrorFileNotExist);
                return(result);
            }
            try
            {
                XDocument        custDoc   = XDocument.Load(xmlFile);
                ValidationResult SubResult = ValidateXml.ValidatePluginDoc(custDoc);
                if (SubResult.HasErrors)
                {
                    result.Errors.AddRange(SubResult.Errors);
                }
            }
            catch (Exception err)
            {
                result.Errors.Add(err.Message);
            }


            return(result);
        }
        /// <summary>
        /// Validates SnipitInstal Xml file
        /// </summary>
        /// <param name="xmlData">String comtaining the xml data for the SnipitInstal</param>
        /// <returns>
        /// <see cref="ValidationResult"/> with <see cref="ValidationResult.HasErrors"/> True if there are errros with the xml;
        /// Othewise <see cref="ValidationResult.HasErrors"/> will be False. Any error messages will be contained in <see cref="ValidationResult.Errors"/>
        /// </returns>
        /// <remarks>Validation occrus against internal XSD file for plugin</remarks>
        public static ValidationResult ValidateSnipitInstalXml(string xmlData)
        {
            ValidationResult result = new ValidationResult();

            if (string.IsNullOrWhiteSpace(xmlData))
            {
                result.Errors.Add(Properties.Resources.ErrorEmptyXmlString);
                return(result);
            }
            try
            {
                XDocument        custDoc   = XDocument.Parse(xmlData);
                ValidationResult SubResult = ValidateXml.ValidateSnipitInstalDoc(custDoc);
                if (SubResult.HasErrors)
                {
                    result.Errors.AddRange(SubResult.Errors);
                }
            }
            catch (Exception err)
            {
                result.Errors.Add(err.Message);
            }


            return(result);
        }
        /// <summary>
        /// Gets a <see cref="ValidationResult"/> with information a specified xml string is valid
        /// </summary>
        /// <param name="xmlData">The xml string to validate</param>
        /// <returns>
        /// Returns <see cref="ValidationResult"/> instance. If any errors are prsent thne <see cref="ValidationResult.HasErrors"/> will be set to true.
        /// Alos if there are errors <see cref="ValidationResult.Errors"/> will contain information about the errors.
        /// </returns>
        /// <remarks>
        /// This method will automatically determine if the xml file is a snippit install, Plugin or Profile and validate depending on type and version.
        /// </remarks>
        public static ValidationResult ValidateXmlString(string xmlData)
        {
            ValidationResult result = new ValidationResult();

            if (string.IsNullOrWhiteSpace(xmlData))
            {
                result.Errors.Add(Properties.Resources.ErrorEmptyXmlString);
                return(result);
            }
            try
            {
                ValidationResult SubResult = null;
                XDocument        custDoc   = XDocument.Parse(xmlData);
                XmlKindEnum      XmlKind   = ValidateXml.GetXmlType(custDoc.Root);
                switch (XmlKind)
                {
                case XmlKindEnum.SnippitInstl:
                    SubResult = ValidateXml.ValidateSnipitInstalDoc(custDoc);
                    break;

                case XmlKindEnum.Plugin:
                    SubResult = ValidateXml.ValidatePluginDoc(custDoc);
                    break;

                case XmlKindEnum.Profile:
                    SubResult = ValidateXml.ValidateProfileDoc(custDoc);
                    break;

                default:
                    SubResult = new ValidationResult();
                    break;
                }
                if (SubResult.HasErrors)
                {
                    result.Errors.AddRange(SubResult.Errors);
                }
            }
            catch (Exception err)
            {
                result.Errors.Add(err.Message);
            }
            return(result);
        }
        /// <summary>
        /// Gets a <see cref="ValidationResult"/> with information a specified xml file is valid
        /// </summary>
        /// <param name="xmlFile">The path to the xml file to validate</param>
        /// <returns>
        /// Returns <see cref="ValidationResult"/> instance. If any errors are prsent thne <see cref="ValidationResult.HasErrors"/> will be set to true.
        /// Alos if there are errors <see cref="ValidationResult.Errors"/> will contain information about the errors.
        /// </returns>
        /// <remarks>
        /// This method will automatically determine if the xml file is a snippit install, Plugin or Profile and validate depending on type and version.
        /// </remarks>
        public static ValidationResult ValidateXmlFile(string xmlFile)
        {
            ValidationResult result = new ValidationResult();

            if (!File.Exists(xmlFile))
            {
                result.Errors.Add(Properties.Resources.ErrorFileNotExist);
                return(result);
            }
            try
            {
                ValidationResult SubResult = null;
                XDocument        custDoc   = XDocument.Load(xmlFile);
                XmlKindEnum      XmlKind   = ValidateXml.GetXmlType(custDoc.Root);
                switch (XmlKind)
                {
                case XmlKindEnum.SnippitInstl:
                    SubResult = ValidateXml.ValidateSnipitInstalDoc(custDoc);
                    break;

                case XmlKindEnum.Plugin:
                    SubResult = ValidateXml.ValidatePluginDoc(custDoc);
                    break;

                case XmlKindEnum.Profile:
                    SubResult = ValidateXml.ValidateProfileDoc(custDoc);
                    break;

                default:
                    SubResult = new ValidationResult();
                    break;
                }
                if (SubResult.HasErrors)
                {
                    result.Errors.AddRange(SubResult.Errors);
                }
            }
            catch (Exception err)
            {
                result.Errors.Add(err.Message);
            }
            return(result);
        }