IsKnownSchema() 공개 정적인 메소드

public static IsKnownSchema ( string schemaNamespace ) : bool
schemaNamespace string
리턴 bool
예제 #1
0
        private static void CheckSchemaVersion(XDocument document)
        {
#if NET45 // CORECLR_TODO: XmlSchema
            // Get the metadata node and look for the schemaVersion attribute
            XElement metadata = GetMetadataElement(document);

            if (metadata != null)
            {
                // Yank this attribute since we don't want to have to put it in our xsd
                XAttribute schemaVersionAttribute = metadata.Attribute(SchemaVersionAttributeName);

                if (schemaVersionAttribute != null)
                {
                    schemaVersionAttribute.Remove();
                }

                // Get the package id from the metadata node
                string packageId = GetPackageId(metadata);

                // If the schema of the document doesn't match any of our known schemas
                if (!ManifestSchemaUtility.IsKnownSchema(document.Root.Name.Namespace.NamespaceName))
                {
                    throw new InvalidOperationException(
                              String.Format(CultureInfo.CurrentCulture,
                                            NuGetResources.IncompatibleSchema,
                                            packageId,
                                            typeof(Manifest).Assembly.GetName().Version));
                }
            }
#endif
        }
예제 #2
0
        private static void CheckSchemaVersion(XDocument document)
        {
            XElement metadataElement = GetMetadataElement(document);

            if (metadataElement != null)
            {
                XAttribute attribute = metadataElement.Attribute("schemaVersion");
                if (attribute != null)
                {
                    attribute.Remove();
                }
                string packageId = GetPackageId(metadataElement);
                if (!ManifestSchemaUtility.IsKnownSchema(document.Root.Name.Namespace.NamespaceName))
                {
                    object[] args = new object[] { packageId, typeof(Manifest).Assembly.GetName().Version };
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, NuGetResources.IncompatibleSchema, args));
                }
            }
        }