public static Uri ResolveSchemaIdAndScopeId(Uri idScope, Uri schemaId, string path, out Uri newScope) { Uri knownSchemaId; if (schemaId != null) { newScope = SchemaDiscovery.ResolveSchemaId(idScope, schemaId); knownSchemaId = newScope; } else { if (idScope == null) { knownSchemaId = new Uri(path, UriKind.RelativeOrAbsolute); } else { knownSchemaId = SchemaDiscovery.ResolveSchemaId(idScope, new Uri(path, UriKind.RelativeOrAbsolute)); } newScope = idScope; } return(knownSchemaId); }
public static Uri ResolveSchemaIdAndScopeId(Uri idScope, JSchema schema, string path, out Uri newScope) { Uri schemaId = schema.Id; Uri knownSchemaId; if (schemaId != null) { try { newScope = SchemaDiscovery.ResolveSchemaId(idScope, schemaId); } catch (Exception ex) { string message = "Error resolving schema ID '{0}' in the current scope. The resolved ID must be a valid URI.".FormatWith(CultureInfo.InvariantCulture, schemaId); throw new JSchemaException(JSchemaException.FormatMessage(schema, schema.Path, message), ex); } knownSchemaId = newScope; } else { if (idScope == null) { knownSchemaId = new Uri(path, UriKind.RelativeOrAbsolute); } else { knownSchemaId = SchemaDiscovery.ResolveSchemaId(idScope, new Uri(path, UriKind.RelativeOrAbsolute)); } newScope = idScope; } return(knownSchemaId); }