/// <summary> /// Read any linkbase references contained directly in the fragment. /// </summary> /// <remarks> /// Linkbase references found as children of XBRL elements is allowed by section /// 4.3 of the XBRL specification. /// </remarks> private void ReadLinkbaseReferences() { thisLinkbaseDocuments = new LinkbaseDocumentCollection(); thisLinkbaseDocuments.ReadLinkbaseReferences(this.XbrlRootNode.BaseURI, this.XbrlRootNode, this); }
//------------------------------------------------------------------------------- //------------------------------------------------------------------------------- internal XbrlSchema(XbrlFragment ContainingXbrlFragment, string SchemaFilename, string BaseDirectory) { this.Fragment = ContainingXbrlFragment; this.SchemaReferencePath = GetFullSchemaPath(SchemaFilename, BaseDirectory); this.LoadPath = this.SchemaReferencePath; try { if (ReadAndCompile(this.SchemaReferencePath) == false) { return; } } catch (FileNotFoundException fnfEx) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("FileNotFoundDuringSchemaCreation"); MessageBuilder.AppendFormat(StringFormat, this.SchemaReferencePath); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString(), fnfEx)); return; } catch (WebException webEx) { // Check to see if we got an HTTP 404 back from an attempt to open a schema up from a // URL. If we did, check to see if the schema is available locally. Some taxonomies are // specified through URLs that don't actually exist in a physical form but just appear // as placeholders. The Dutch taxonomies are an example of this. An XBRL instance might // have a schema reference of "http://archprod.service.eogs.dk/taxonomy/20171001/ // entryDanishGAAPBalanceSheetAccountFormIncomeStatementByNatureIncludingManagements // ReviewStatisticsAndTax20171001.xsd", for example, but there might not be a schema // at that location. It is assumed, in these cases, that the schema is available with // the XBRL instance itself. Check for a locally-stored schema. var localSchemaAvailable = false; var schemaLocalPath = string.Empty; var webResponse = webEx.Response as HttpWebResponse; if (webResponse == null || webResponse.StatusCode == HttpStatusCode.NotFound) { schemaLocalPath = BuildSchemaPathLocalToFragment(ContainingXbrlFragment, SchemaFilename); try { localSchemaAvailable = ReadAndCompile(schemaLocalPath); } catch (FileNotFoundException) { localSchemaAvailable = false; } } if (localSchemaAvailable == false) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("WebExceptionThrownDuringSchemaCreation"); MessageBuilder.AppendFormat(StringFormat, this.SchemaReferencePath); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString(), webEx)); return; } this.LoadPath = schemaLocalPath; } thisSchemaDocument = Container.Resolve <IDocument>(); this.thisLinkbaseDocuments = new LinkbaseDocumentCollection(); this.RoleTypes = new List <RoleType>(); thisSchemaDocument.Load(this.LoadPath); this.NamespaceManager = Container.Resolve <INamespaceManager>(); this.NamespaceManager.Document = thisSchemaDocument; this.NamespaceManager.AddNamespace("schema", XbrlSchema.XmlSchemaNamespaceUri); ReadSchemaNode(); ReadSimpleTypes(); ReadComplexTypes(); ReadElements(); LookForAnnotations(); }