/// <summary> /// Parse the <see cref="XmlDocument"/> underlying this <see cref="Presentation"/> object, /// populating role and link information. /// </summary> /// <param name="numErrors">An output parameter. The number of errors encountered during /// the parse process.</param> protected override void ParseInternal(out int numErrors) { numErrors = 0; try { XmlNodeList locNodes = theDocument.SelectNodes(LOCATOR_KEY, theManager); if (locNodes == null || locNodes.Count == 0) { //Common.WriteError("XBRLParser.Error.LabelDoesNotContainLabels", errorList, schemaFilename); //++numErrors; return; } } catch { //No need to write the exception again, more than likely, the exception is already caught outside (missing label file) return; } XmlNodeList labelList = theDocument.SelectNodes(LABEL_LINK_KEY, theManager); labels = new Hashtable(); foreach (XmlNode node in labelList) { LabelLink ll = new LabelLink(errorList); ll.ParseLinks(node, theManager, out numErrors); if (ll.Labels != null) { foreach (LabelLocator lloc in ll.Labels.Values) { LabelLocator orig = labels[lloc.HRef] as LabelLocator; if (orig == null) { labels[lloc.HRef] = lloc; } else { orig.AddLabels(lloc, errorList); } } } } ParseRolesAndLanguages(ref numErrors); }
internal LabelLocator CreateCopyForMerging() { LabelLocator clone = new LabelLocator(); clone.CopyLocatorBaseInformation(this); //clone.labelDatas = new List<LabelDefinition>(this.labelDatas); foreach (LabelDefinition ld in this.labelDatas) { clone.labelDatas.Add(new LabelDefinition(ld.LabelRole, ld.Language, ld.Label)); } return(clone); }
/// <summary> /// Determines whether a supplied <see cref="Object"/> is equal to this <see cref="LabelLocator"/>. /// </summary> /// <param name="obj">The <see cref="Object"/> to be compared to this <see cref="LabelLocator"/>. /// Assumed to be a <see cref="LabelLocator"/>.</param> /// <returns>True if <paramref name="obj"/> is equal to this <see cref="LabelLocator"/>.</returns> /// <remarks>To be equal, the collection of <see cref="LabelDefinition"/> associated with both /// <see cref="LabelLocator"/> objects must be the same size.</remarks> public override bool Equals(object obj) { if (!(obj is LabelLocator)) { return(false); } LabelLocator ll = obj as LabelLocator; // just check size of labelDatas if (labelDatas.Count != ll.labelDatas.Count) { return(false); } return(true); }
internal int AddLabels(LabelLocator dupLocator, ArrayList errors) { int warnings = 0; for (int i = 0; i < dupLocator.labelDatas.Count; i++) { if (!this.AddLabel(dupLocator.labelDatas[i])) { //why bother? //Common.WriteWarning("XBRLParser.Warning.DuplicateLabelForLanguage", // errors, Label, // dupLocator.labelDatas[i].Language, // dupLocator.labelDatas[i].LabelRole, // dupLocator.labelDatas[i].LabelRole, dupLocator.labelDatas[i].Label); } } return(warnings); }
internal LabelLocator CreateCopyForMerging() { LabelLocator clone = new LabelLocator(); clone.CopyLocatorBaseInformation(this); //clone.labelDatas = new List<LabelDefinition>(this.labelDatas); foreach (LabelDefinition ld in this.labelDatas) { clone.labelDatas.Add(new LabelDefinition(ld.LabelRole, ld.Language, ld.Label)); } return clone; }
internal int AddLabels( LabelLocator dupLocator, ArrayList errors ) { int warnings = 0; for (int i = 0; i < dupLocator.labelDatas.Count; i++) { if (!this.AddLabel(dupLocator.labelDatas[i])) { //why bother? //Common.WriteWarning("XBRLParser.Warning.DuplicateLabelForLanguage", // errors, Label, // dupLocator.labelDatas[i].Language, // dupLocator.labelDatas[i].LabelRole, // dupLocator.labelDatas[i].LabelRole, dupLocator.labelDatas[i].Label); } } return warnings; }
private Element(Element e, bool UseClone) { this.id = e.id; this.prefix = e.prefix; this.nameWithNSPrefix = e.nameWithNSPrefix; this.name = e.name; this.type = e.type; this.origElementType = e.origElementType; this.substGroup = e.substGroup; this.attributeType = e.attributeType; this.isNull = e.isNull; this.tuple = e.tuple; this.nillable = e.nillable; this.perType = e.perType; this.balType = e.balType; this.abst = e.abst; this.typedDimensionId = e.typedDimensionId; //this.tupleChildren = e.tupleChildren; // need to do a deep copy - the IM taxonomy on .NET 2.0 children are pointing to the wrong parent // this didn't seem to make a difference, but I think it's a good thing, so I'm going to leave it in if (UseClone) { if (e.tupleChildren != null) { tupleChildren = new SortedList(); IDictionaryEnumerator enumer = e.tupleChildren.GetEnumerator(); while (enumer.MoveNext()) { this.AddChild((double)enumer.Key, (Element)((Element)enumer.Value).Clone()); } } if (e.tupleParentList != null) { tupleParentList = new List<Element>(); foreach( Element tp in e.tupleParentList ) { if (tp.id == this.id) { tupleParentList.Add(this); } else { tupleParentList.Add(tp.Clone() as Element); } } } } else { this.tupleChildren = e.tupleChildren; this.tupleParentList = e.tupleParentList; } this.labelInfo = e.labelInfo; this.referenceInfo = e.referenceInfo; this.taxonomyInfoId = e.taxonomyInfoId; this.markupValues = e.markupValues; this.EnumData = e.EnumData; this.IsAucentExtendedElement = e.IsAucentExtendedElement; this.HasCompleteTupleFamily = e.HasCompleteTupleFamily; this.isChoice = e.isChoice; this.UseChoiceIcon = e.UseChoiceIcon; this.ChoiceContainer = e.ChoiceContainer; this.childrenInfo = e.childrenInfo; }
/// <summary> /// Adds the <see cref="LabelDefinition"/> objects within a supplied collection to this /// <see cref="Element"/>'s collection of labels. /// </summary> /// <param name="labels">An <see cref="Array"/> of <see cref="LabelDefinition"/>.</param> public void UpdateLabels(LabelDefinition[] labels) { if (labelInfo == null) { labelInfo = new LabelLocator(); } labelInfo.Update(labels); }