当前位置: 首页>>代码示例>>C#>>正文


C# Reference.Parse方法代码示例

本文整理汇总了C#中Reference.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Reference.Parse方法的具体用法?C# Reference.Parse怎么用?C# Reference.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reference的用法示例。


在下文中一共展示了Reference.Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryGetReferenceInformation

        public static bool TryGetReferenceInformation(string fileName,
            ref Dictionary<string, string> referenceByElementId, out string err)
        {
            if (referenceByElementId == null)
            {
                referenceByElementId = new Dictionary<string, string>();
            }
            err = null;

            //assuming local file
            if (File.Exists(fileName))
            {
                Reference reference = new Reference();
                reference.loadingTaxonomy = null;
                reference.PromptUser = false;
                int numErrors;

                reference.Load(fileName, out numErrors);
                if (numErrors == 0)
                {
                    reference.Parse(out numErrors);

                }

                if (numErrors > 0)
                {
                    err = "Failed to load reference file " + fileName;
                    return false;
                }

                if (reference.ReferencesTable != null)
                {
                    string formatStr = TraceUtility.FormatStringResource("XBRLUserControls.ElementBuilder.ReferenceNum");

                    foreach (ReferenceLocator refLocator in reference.ReferencesTable.Values)
                    {
                        if (refLocator.References != null && refLocator.References.Count > 0)
                        {
                            StringBuilder sbReference = new StringBuilder();

                            int refCount = 1;

                            foreach (DictionaryEntry de in refLocator.References)
                            {
                                sbReference.Append(string.Format(formatStr, refCount));

                                string key = de.Key as String;
                                int index = key.LastIndexOf(" ");
                                if (index >= 0)
                                {
                                    key = key.Substring(0, index);
                                }
                                sbReference.Append(key);
                                sbReference.Append(Environment.NewLine);

                                ArrayList arRef = de.Value as ArrayList;
                                if (arRef[0] is string)
                                {

                                    foreach (string refItem in arRef)
                                    {
                                        sbReference.Append(" -").Append(refItem);
                                    }
                                }
                                else
                                {
                                    if (arRef[0] is System.Collections.DictionaryEntry)
                                    {
                                        foreach (System.Collections.DictionaryEntry refItem in arRef)
                                        {
                                            sbReference.Append(" -").Append(refItem.Key).Append(": ").
                                                Append(refItem.Value).Append(Environment.NewLine);
                                        }
                                    }
                                }

                                sbReference.Append(Environment.NewLine);

                                refCount++;
                            }

                            referenceByElementId[refLocator.href] = sbReference.ToString();
                        }

                    }

                }

            }
            else
            {
                err = "Reference file does not exist " + fileName;
            }

            return err == null;
        }
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:96,代码来源:TaxonomyCommercialFeatures.cs

示例2: LoadReferences

        private void LoadReferences( out int numErrors )
        {
            numErrors = 0;

            if ( dependantTaxonomies.Count == 0 )
            {
                int errs = LoadDependantTaxonomies(this.schemaPath);
                numErrors += errs;
                numRefErrors += errs;
            }

            if ( referenceFile == null )
            {
                referenceFile = GetLinkbaseReference( TARGET_LINKBASE_URI + REFERENCE_ROLE );
            }
            int errors = 0;

            if ( referenceTable == null )
            {
                referenceTable = new Hashtable();
            }

            if ( referenceFile != null )
            {
                foreach ( string refFile in referenceFile )
                {
                    Reference reference = new Reference();
                    reference.OwnerHandle = OwnerHandle;
                    reference.loadingTaxonomy = this.GetLoadingTaxonomy();
                    reference.PromptUser = this.PromptUser;

                    if ( refFile != null )
                    {
                        reference.Load( refFile, out numErrors );
                        if (IsAucentExtension && skipAucentExtensions && !this.innerTaxonomy &&
                            reference.IsDocumentCreatedByRivet())
                        {
                            //if this is a top level aucent extension taxonomy and ...
                            //if the skipAucentExtensions is set to true ... we want to load just the no rivet created files...
                            //as we will merge the rivet created files later....
                            continue ;
                        }
                        if ( reference.ErrorList.Count > 0 )
                        {
                            for ( int i = 0; i < reference.ErrorList.Count; i++ )
                                Common.WriteError( "XBRLParser.Error.Exception", validationErrors,
                                    SchemaFile + ": REFERENCE_ROLE Error: " + reference.ErrorList[i] );
                        }

                        reference.Parse( out errors );
                        if ( errors > 0 )
                        {
                            numErrors += errors;
                            errorList.AddRange( reference.ErrorList );
                            numRefErrors += errors;
                        }

                        LinkbaseFileInfo refLinkbaseInfo = new LinkbaseFileInfo();
                        refLinkbaseInfo.LinkType = LinkbaseFileInfo.LinkbaseType.Reference;
                        refLinkbaseInfo.Filename = refFile;
                        refLinkbaseInfo.XSDFileName = schemaFile;

                        this.linkbaseFileInfos.Add(refLinkbaseInfo);

                    }

                    if ( reference.ReferencesTable != null )
                    {
                        IDictionaryEnumerator enumer = reference.ReferencesTable.GetEnumerator();
                        foreach( ReferenceLocator otherRL in reference.ReferencesTable.Values )
                        {
                            if (referenceTable.Contains(otherRL.HRef))
                            {
                                //TODO: add merge code similar to label locators
                                int i = 0; ++i;

                                ReferenceLocator rl = (ReferenceLocator)referenceTable[otherRL.HRef];
                                rl.Merge( otherRL );
                            }
                            else
                            {
                                referenceTable[otherRL.HRef] = otherRL;
                            }
                        }
                    }
                }
            }

            if ( !innerTaxonomy )
            {
                //append the references to the root level referenceTable
                foreach ( Taxonomy t in dependantTaxonomies )
                {
                    if ( t.referenceTable != null && t.referenceTable.Count > 0 )
                    {
                        errors = 0;
                        // now append the references
                        IDictionaryEnumerator enumer = t.referenceTable.GetEnumerator();
                        while ( enumer.MoveNext() )
                        {
//.........这里部分代码省略.........
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:101,代码来源:Taxonomy.cs


注:本文中的Reference.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。