/// <summary>
        /// Performs a check against a <see cref="XDocument"/> to see if the schema is valid.
        /// </summary>
        /// <param name="doc">The <see cref="XDocument"/> to check its schema.</param>
        /// <param name="schema">The schema to use for validation.</param>
        public static void ValidateXml(this XDocument doc, string schema)
        {
            Assertions.AssertNotNull(doc, "doc");
            Assertions.AssertNotEmpty(schema, "schema");

            XmlSchemaSet xss = new XmlSchemaSet();

            xss.Add(string.Empty, XmlReader.Create(new StringReader(schema)));
            doc.Validate(xss, null, false);
        }
        /// <summary>
        /// Retrieves the resource string of a resource specified in the assembly's main resources.
        /// </summary>
        /// <param name="sourceType">The type of which to infer the assembly's resources from.</param>
        /// <param name="resourceName">The resource name to retrieve the string resource.</param>
        /// <returns>The resource specified by the given name.
        /// -or- null, if no resource with such name was found.</returns>
        public static string GetResourceString(this Type sourceType, string resourceName)
        {
            Assertions.AssertNotNull(sourceType, "sourceType");
            Assertions.AssertNotEmpty(resourceName, "resourceName");

            string resmantype = sourceType.Assembly.GetName().Name + ".Properties.Resources";

            ResourceManager resman = new ResourceManager(resmantype, sourceType.Assembly);

            return(resman.GetString(resourceName));
        }
        /// <summary>
        /// Performs a check against a <see cref="XDocument"/> to see if the schema is valid.
        /// </summary>
        /// <param name="doc">The <see cref="XDocument"/> to check its schema.</param>
        /// <param name="schema">The schema to use for validation.</param>
        /// <returns>A boolean value indicating whether or not the schema of the given <see cref="XDocument"/> is valid, or not.</returns>
        public static bool IsXmlValid(this XDocument doc, string schema)
        {
            Assertions.AssertNotNull(doc, "doc");
            Assertions.AssertNotEmpty(schema, "schema");

            try
            {
                ValidateXml(doc, schema);
            }
            catch (XmlSchemaException)
            {
                return(false);
            }
            catch (XmlException)
            {
                return(false);
            }
            return(true);
        }