private bool AddUnresolvedSchemaRefs(XmlNS.Schema.XmlSchema schema) { if (schema != null) { foreach (XmlNS.Schema.XmlSchemaExternal schemaExternal in schema.Includes) { if (!this.UnresolvedReferences.Any(r => r.SchemaExternal == schemaExternal)) { if (!string.IsNullOrEmpty(schemaExternal.SchemaLocation)) { schemaExternal.SchemaLocation = MetadataFileNameManager.GetComposedUri(schema.SourceUri, schemaExternal.SchemaLocation); UnresolvedReferences.Add(new UnresolvedUri { Schema = schema, SchemaExternal = schemaExternal }); } else if (schemaExternal.Schema == null) { // the MetadataExchangeClient when using MEX protocol downloads wsdl-embedded schemas separately, // need to gather namespace-only imports (which are valid w/o any schema) to be able to connect // the docs if it is the case. var schemaImport = schemaExternal as XmlNS.Schema.XmlSchemaImport; if (schemaImport != null && !string.IsNullOrEmpty(schemaImport.Namespace)) { UnresolvedReferences.Add(new UnresolvedUri { Schema = schema, SchemaExternal = schemaExternal, Namespace = schemaImport.Namespace }); } } } } return(true); } return(false); }
public static MetadataSection CreateFromSchema(XsdNS.XmlSchema schema) { if (schema == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("schema"); } MetadataSection section = new MetadataSection(); section.Dialect = MetadataSection.XmlSchemaDialect; section.Identifier = schema.TargetNamespace; section.Metadata = schema; return(section); }