private void ValidateScenarioNode(INode ScenarioNode) { if (ScenarioNode.NamespaceURI.Equals(XbrlDocument.XbrlNamespaceUri) == true) { string MessageFormat = AssemblyResources.GetName("ScenarioNodeUsingXBRLNamespace"); StringBuilder MessageBuilder = new StringBuilder(); MessageBuilder.AppendFormat(MessageFormat, validatingContext.Id, ScenarioNode.Name); this.validatingFragment.AddValidationError(new ContextValidationError(validatingContext, MessageBuilder.ToString())); } if (ScenarioNode.Prefix.Length > 0) { XbrlSchema NodeSchema = this.validatingFragment.GetXbrlSchemaForPrefix(ScenarioNode.Prefix); if (NodeSchema != null) { Element NodeElement = NodeSchema.GetElement(ScenarioNode.LocalName); if (NodeElement != null) { if (NodeElement.SubstitutionGroup != Element.ElementSubstitutionGroup.Unknown) { string MessageFormat = AssemblyResources.GetName("ScenarioNodeUsingSubGroupInXBRLNamespace"); StringBuilder MessageBuilder = new StringBuilder(); MessageBuilder.AppendFormat(MessageFormat, validatingContext.Id, ScenarioNode.Name, NodeSchema.Path); this.validatingFragment.AddValidationError(new ContextValidationError(validatingContext, MessageBuilder.ToString())); } } } } foreach (INode CurrentChild in ScenarioNode.ChildNodes) { ValidateScenarioNode(CurrentChild); } }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal Element(XbrlSchema Schema, XmlSchemaElement SchemaElement) { this.Schema = Schema; thisSchemaElement = SchemaElement; this.Id = SchemaElement.Id; this.Name = SchemaElement.Name; this.TypeName = SchemaElement.SchemaTypeName; SetSubstitutionGroup(SchemaElement.SubstitutionGroup); SetPeriodType(); }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal Element(XbrlSchema Schema, ISchemaElement SchemaElement) { this.Schema = Schema; thisSchemaElement = SchemaElement; this.Id = SchemaElement.Id; this.Name = SchemaElement.Name; this.IsAbstract = SchemaElement.IsAbstract; this.TypeName = SchemaElement.SchemaTypeName; SetSubstitutionGroup(SchemaElement.SubstitutionGroup); SetPeriodType(); }
/// <summary> /// Validates all summation concepts defined in the current schema. /// </summary> /// <param name="CurrentSchema"> /// The schema whose containing summation concepts should be validated. /// </param> private void Validate(XbrlSchema CurrentSchema) { var calculationLinkbase = CurrentSchema.CalculationLinkbase; if (calculationLinkbase == null) { return; } foreach (CalculationLink CurrentCalculationLink in calculationLinkbase.CalculationLinks) { Validate(CurrentCalculationLink); } }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal LinkbaseDocument(XbrlSchema ContainingXbrlSchema, string DocumentPath) { this.DefinitionLinks = new List<DefinitionLink>(); this.CalculationLinks = new List<CalculationLink>(); this.LabelLinks = new List<LabelLink>(); this.Schema = ContainingXbrlSchema; thisLinkbasePath = GetFullLinkbasePath(DocumentPath); thisXmlDocument = new XmlDocument(); thisXmlDocument.Load(thisLinkbasePath); thisNamespaceManager = new XmlNamespaceManager(thisXmlDocument.NameTable); thisNamespaceManager.AddNamespace("default", "http://www.xbrl.org/2003/linkbase"); ReadLinkbaseNode(); }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal RoleType(XbrlSchema ContainingXbrlSchema, XmlNode roleTypeNode) { this.Schema = ContainingXbrlSchema; this.UsedOnReferences = new List<string>(); this.RoleUri = new Uri(XmlUtilities.GetAttributeValue(roleTypeNode, "roleURI")); this.Id = XmlUtilities.GetAttributeValue(roleTypeNode, "id"); foreach (XmlNode currentChild in roleTypeNode.ChildNodes) { if (currentChild.LocalName.Equals("definition") == true) { this.Definition = currentChild.InnerText; } if (currentChild.LocalName.Equals("usedOn") == true) { this.UsedOnReferences.Add(currentChild.InnerText); } } }
private void ValidateSegmentNodePrefix(INode SegmentNode) { if (SegmentNode.Prefix.Length > 0) { XbrlSchema NodeSchema = this.validatingFragment.GetXbrlSchemaForPrefix(SegmentNode.Prefix); if (NodeSchema != null) { Element NodeElement = NodeSchema.GetElement(SegmentNode.LocalName); if (NodeElement != null) { if (NodeElement.SubstitutionGroup != Element.ElementSubstitutionGroup.Unknown) { string MessageFormat = AssemblyResources.GetName("SegmentNodeUsingSubGroupInXBRLNamespace"); StringBuilder MessageBuilder = new StringBuilder(); MessageBuilder.AppendFormat(MessageFormat, validatingContext.Id, SegmentNode.Name, NodeSchema.Path); this.validatingFragment.AddValidationError(new ContextValidationError(validatingContext, MessageBuilder.ToString())); } } } } }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal Element(XbrlSchema Schema, XmlNode ElementNode) { throw new NotSupportedException("no more hardcoded parsing of schema elements!"); }
/// <summary> /// Creates a XML schema type for use by the internally-implemented XML schema type system. /// </summary> /// <param name="Schema"> /// The schema containing the definition of the type. /// </param> /// <param name="TypeName"> /// The name of the type to be created. Specific types are created according to the following table: /// <list type="table"> /// <listeader> /// <term> /// Type Name /// </term> /// <description> /// Specific Class of Returned Object /// </description> /// </listeader> /// <item> /// <term> /// token /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.Token"/> /// </description> /// </item> /// <item> /// <term> /// string /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.String"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:decimalItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.DecimalItemType"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:monetaryItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.MonetaryItemType"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:pureItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.PureItemType"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:sharesItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.SharesItemType"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:tokenItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.TokenItemType"/> /// </description> /// </item> /// <item> /// <term> /// xbrli:stringItemType /// </term> /// <description> /// <see cref="JeffFerguson.Gepsio.Xsd.StringItemType"/> /// </description> /// </item> /// </list> /// <para> /// If a type name not shown above is supplied, then null will be returned. /// </para> /// </param> /// <returns> /// A type object representing the type referenced by the parameter, or null if the type name is /// not supported. /// </returns> public static AnyType CreateType(string TypeName, XbrlSchema Schema) { return(AnyType.CreateType(TypeName, Schema.SchemaRootNode)); }
//------------------------------------------------------------------------------- // Searches the given XBRL schemas, looking for facts that are referenced // in arc roles. //------------------------------------------------------------------------------- private void ValidateFactsReferencedInDefinitionArcRoles(XbrlSchema CurrentSchema) { if (CurrentSchema.LinkbaseDocuments != null) { foreach (LinkbaseDocument CurrentLinkbaseDocument in CurrentSchema.LinkbaseDocuments) ValidateFactsReferencedInDefinitionArcRoles(CurrentLinkbaseDocument); } }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ internal Element(XbrlSchema Schema, INode ElementNode) { throw new NotSupportedException("no more hardcoded parsing of schema elements!"); }
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ private void GetSchemaElementFromSchema() { foreach (XbrlSchema CurrentSchema in thisParentFragment.Schemas) { if (CurrentSchema.TargetNamespace == this.Namespace) { thisSchema = CurrentSchema; } } if (thisSchema == null) { if (thisParentFragment.Schemas.Count == 0) { string MessageFormat = AssemblyResources.GetName("NoSchemasForFragment"); StringBuilder MessageFormatBuilder = new StringBuilder(); MessageFormatBuilder.AppendFormat(MessageFormat); thisParentFragment.AddValidationError(new ItemValidationError(this, MessageFormatBuilder.ToString())); } thisSchema = thisParentFragment.Schemas[0]; } this.SchemaElement = thisSchema.GetElement(this.Name); if (this.SchemaElement == null) { string MessageFormat = AssemblyResources.GetName("CannotFindFactElementInSchema"); StringBuilder MessageFormatBuilder = new StringBuilder(); MessageFormatBuilder.AppendFormat(MessageFormat, this.Name, thisSchema.Path); thisParentFragment.AddValidationError(new ItemValidationError(this, MessageFormatBuilder.ToString())); } }