Validate() public method

public Validate ( Stream xmlStream ) : bool
xmlStream Stream
return bool
        /// <summary>
        /// Method is invoked when portal template is imported or user selects Import content from menu.
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="content"></param>
        /// <param name="version"></param>
        /// <param name="userId"></param>
        public void ImportModule(int moduleId, string content, string version, int userId)
        {
            // TODO: implement Import for Text/HTML modules
            var validator = new TransportableXmlValidator();
            var stream = new MemoryStream(Encoding.UTF8.GetBytes(content));

            if (validator.Validate(stream) == false)
            {
                var invalidXml = new Exception("Unable to import publish content due to incompatible XML file. Error: " + validator.Errors[0]);
                Exceptions.LogException(invalidXml);
                throw invalidXml;
            }

            // The DNN ValidatorBase closes the stream? Must re-create. hk
            stream = new MemoryStream(Encoding.UTF8.GetBytes(content));
            var doc = new XPathDocument(stream);
            var builder = new XmlTransporter(moduleId);

            // TODO: we need to set the ItemID setting to be this recently imported article
            try
            {
                XmlDirector.Deconstruct(builder, doc);
            }
            catch (Exception e)
            {
                Exceptions.LogException(new Exception(e.ToString()));
                throw;
            }
        }
        /// <summary>
        /// Method is invoked when portal template is imported or user selects Import content from menu.
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="content"></param>
        /// <param name="version"></param>
        /// <param name="userId"></param>
        public void ImportModule(int moduleId, string content, string version, int userId)
        {
            try
            {
                var validator = new TransportableXmlValidator();
                var stream = new MemoryStream(Encoding.UTF8.GetBytes(content));

                if (validator.Validate(stream) == false)
                {
                    var invalidXml = new Exception("Unable to import publish content due to incompatible XML file. Error: " + validator.Errors[0]);
                    Exceptions.LogException(invalidXml);
                    throw invalidXml;
                }

                // The DNN ValidatorBase closes the stream? Must re-create. hk
                stream = new MemoryStream(Encoding.UTF8.GetBytes(content));
                var doc = new XPathDocument(stream);
                var builder = new XmlTransporter(moduleId);
                XmlDirector.Deconstruct(builder, doc);
            }
            catch (Exception e)
            {
                Exceptions.LogException(e);
                throw;
            }
        }