コード例 #1
0
        private async Task LoadAsXmlSchemaIncludesAsync(XmlNS.Schema.XmlSchema schema, string uri, string basePath, CancellationToken cancellationToken)
        {
            foreach (XmlNS.Schema.XmlSchemaExternal externalSchema in schema.Includes)
            {
                if (!string.IsNullOrEmpty(externalSchema.SchemaLocation))
                {
                    var schemaImport     = externalSchema as XmlNS.Schema.XmlSchemaImport;
                    var schemaNamespace  = schemaImport != null ? schemaImport.Namespace : schema.TargetNamespace;
                    var resolvedLocation = await LoadAsSchemaImportLocationAsync(externalSchema.SchemaLocation, uri, basePath, schemaNamespace, ".xsd", cancellationToken).ConfigureAwait(false);

                    externalSchema.SchemaLocation = resolvedLocation;
                }
            }
        }
コード例 #2
0
        private void UpdateSchemaSourceUri(XmlNS.Schema.XmlSchema schema, string sourceUri)
        {
            if (schema != null && !IsSchemaUpdated(schema.SourceUri))
            {
                if (string.IsNullOrEmpty(schema.SourceUri))
                {
                    schema.SourceUri = sourceUri;
                }

                foreach (XmlNS.Schema.XmlSchemaExternal include in schema.Includes)
                {
                    if (include.Schema != null)
                    {
                        UpdateSchemaSourceUri(include.Schema, schema.SourceUri);
                    }
                }
            }
        }