//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ 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())); } }
private void ValidateScenarioNode(INode ScenarioNode) { if (ScenarioNode.NamespaceURI.Equals(XbrlDocument.XbrlNamespaceUri) == true) { string MessageFormat = AssemblyResources.GetName("ScenarioNodeUsingXBRLNamespace"); StringBuilder MessageBuilder = new StringBuilder(); MessageBuilder.AppendFormat(MessageFormat, this.Id, ScenarioNode.Name); this.Fragment.AddValidationError(new ContextValidationError(this, MessageBuilder.ToString())); } if (ScenarioNode.Prefix.Length > 0) { XbrlSchema NodeSchema = this.Fragment.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, this.Id, ScenarioNode.Name, NodeSchema.Path); this.Fragment.AddValidationError(new ContextValidationError(this, MessageBuilder.ToString())); } } } } foreach (INode CurrentChild in ScenarioNode.ChildNodes) { ValidateScenarioNode(CurrentChild); } }
private void ValidateSegmentNodePrefix(INode SegmentNode) { if (SegmentNode.Prefix.Length > 0) { XbrlSchema NodeSchema = this.Fragment.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, this.Id, SegmentNode.Name, NodeSchema.Path); this.Fragment.AddValidationError(new ContextValidationError(this, MessageBuilder.ToString())); } } } } }