Пример #1
0
        private void LoadPresentationLinkbase( Presentation p, string linkbase, out int numErrors )
        {
            numErrors = 0;

            string baseUri = GetTargetNamespace();

            if ( baseUri[baseUri.Length - 1] != '/' && baseUri[baseUri.Length - 1] != '\\' )
            {
                baseUri += "/";
            }
            string bs = baseUri + schemaFilename;

            Dictionary<string, string> discoveredSchemas = new Dictionary<string, string>();

            if ( linkbase.StartsWith( "http" ) )
            {
                baseUri = linkbase.Replace( Path.GetFileName( linkbase ), string.Empty );
            }

            p.BaseSchema = bs;
            p.OwnerHandle = OwnerHandle;
            p.Load( linkbase );
            if (IsAucentExtension && skipAucentExtensions && !this.innerTaxonomy &&
                p.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....
                return;
            }
            if ( p.ErrorList.Count > 0 )
            {
                if ( p.ProcessingPresenationType == Presentation.PreseantationTypeCode.Presentation )
                {
                    for ( int i = 0; i < p.ErrorList.Count; i++ )
                        Common.WriteError( "XBRLParser.Error.Exception", validationErrors,
                            this.SchemaFile + ": PRESENTATION_ROLE Error: " + p.ErrorList[i] );
                }
                else
                {

                    for ( int i = 0; i < p.ErrorList.Count; i++ )
                        Common.WriteError( "XBRLParser.Error.Exception", validationErrors,
                            this.SchemaFile + ": CALCULATION_ROLE Error: " + p.ErrorList[i] );

                }
            }

            p.Parse(  discoveredSchemas,
                out numErrors );

            foreach ( string val in discoveredSchemas.Values )
            {
                string filename = Path.GetFileName( val );
                string hintPath = val.Replace( filename, string.Empty );

                LoadAdditionalDependantTaxonomy(filename, hintPath, ref  numErrors);
            }
        }
Пример #2
0
        internal Presentation LoadCalculationSchema( out int numErrors )
        {
            numErrors = 0;
            calculationFile = GetLinkbaseReference( TARGET_LINKBASE_URI + CALCULATION_ROLE );

            if ( calculationFile == null )
                return null;

            Hashtable tempCalcHash = new Hashtable();
            Presentation tempCalc = new Presentation();
            tempCalc.loadingTaxonomy = this.GetLoadingTaxonomy();
            tempCalc.PromptUser = this.PromptUser;

            tempCalc.ProcessingPresenationType = Presentation.PreseantationTypeCode.Calculation;

            foreach ( string calcFile in calculationFile )
            {
                LoadPresentationLinkbase( tempCalc, calcFile, out numErrors );

                //build the calculation links
                if ( tempCalc.CalculationLinks != null )
                {
                    IDictionaryEnumerator calcLinkEnumer = tempCalc.CalculationLinks.GetEnumerator();
                    while ( calcLinkEnumer.MoveNext() )
                    {
                        if ( !tempCalcHash.ContainsKey( calcLinkEnumer.Key ) )
                        {
                            tempCalcHash[calcLinkEnumer.Key] = calcLinkEnumer.Value;
                        }
                        else
                        {
                            //need to merge the info..
                            ArrayList tmp = new ArrayList();
                            PresentationLink orig = tempCalcHash[calcLinkEnumer.Key] as PresentationLink;
                            orig.Append(calcLinkEnumer.Value as PresentationLink, tmp);
                        }

                    }
                }

                //build the roleRefs
                this.MergeRoleRefsFromLinkbase(tempCalc.roleRefs, tempCalc.BaseSchema,
                    tempCalc.SchemaFile,  LinkbaseFileInfo.LinkbaseType.Calculation);
                tempCalc.roleRefs = null;
            }

            Presentation p = new Presentation();
            p.ProcessingPresenationType = Presentation.PreseantationTypeCode.Calculation;

            p.CalculationLinks = tempCalcHash;

            return p;
        }
Пример #3
0
        private void LoadCalculation( out int numErrors )
        {
            numErrors = 0;

            Presentation p = LoadCalculationSchema(out numErrors);
            if ( p == null && innerTaxonomy )
                return;

            if ( p == null )
            {
                p = new Presentation();
                p.CalculationLinks = new Hashtable();
            }

            calculationInfo = p.CalculationLinks;

            if ( !innerTaxonomy )
            {
                if ( dependantTaxonomies.Count == 1 )
                {
                    // it's just a simple merge
                    calculationInfo = MergePresentations( ((Taxonomy)dependantTaxonomies[0]).calculationInfo, calculationInfo, out errorList );
                }
                else if ( dependantTaxonomies.Count > 1 )
                {
                    for ( int i = dependantTaxonomies.Count - 1; i != 0; --i )
                    {
                        ((Taxonomy)dependantTaxonomies[i - 1]).calculationInfo = MergePresentations( ((Taxonomy)dependantTaxonomies[i]).calculationInfo,
                            ((Taxonomy)dependantTaxonomies[i - 1]).calculationInfo, out errorList );
                        numErrors += errorList.Count;
                        numCalcErrors += errorList.Count;
                    }

                    // now merge against the current presentation
                    calculationInfo = MergePresentations( calculationInfo,
                        ((Taxonomy)dependantTaxonomies[0]).calculationInfo, out errorList );
                    numErrors += errorList.Count;
                    numCalcErrors += errorList.Count;
                }

                // nothing to do if there are no inner taxonomies
            }
            //if ( calculationInfo != null )
            //{
            //    foreach ( PresentationLink pl in calculationInfo.Values )
            //    {
            //        int err = 0;
            //        pl.RemoveRecursiveLocator( ref err );
            //        numErrors += err;
            //        numCalcErrors += err;

            //        if ( pl.ErrorList != null )
            //        {
            //            errorList.AddRange( pl.ErrorList );
            //        }
            //    }
            //}

            if ( numErrors > 0 )
            {
                errorList.AddRange( p.ErrorList );
            }
        }
Пример #4
0
        public void LoadPresentation( out int numErrors )
        {
            numErrors = 0;

            Presentation p = LoadPresentationSchema( out numErrors );

            if ( p == null && innerTaxonomy )
                return;	// nothing to do

            if ( p == null )
            {
                p = new Presentation();
                p.PresentationLinks = new Hashtable();
            }

            p.OwnerHandle = OwnerHandle;
            p.ProcessingPresenationType = Presentation.PreseantationTypeCode.Presentation;

            presentationInfo = p.PresentationLinks;

            #if OBSOLETE
            if ( roleTypes != null )
            {
                int errors = 0;
                if ( !VerifyPresentationTypes( p, out errors ) )
                {
                    numErrors += errors;
                }
            }
            #endif
            // as presentations get merged, null the child presentations out so they don't get counted twice
            //			if ( !innerTaxonomy )
            //			{
            if ( dependantTaxonomies.Count == 1 )
            {
                // it's just a simple merge
                presentationInfo = MergePresentations(presentationInfo, ((Taxonomy)dependantTaxonomies[0]).presentationInfo, out errorList);
                ((Taxonomy)dependantTaxonomies[0]).presentationInfo = null;
            }
            else if ( dependantTaxonomies.Count > 1 )
            {
                for ( int i = dependantTaxonomies.Count - 1; i != 0; --i )
                {
                    ((Taxonomy)dependantTaxonomies[i - 1]).presentationInfo = MergePresentations( ((Taxonomy)dependantTaxonomies[i - 1]).presentationInfo,
                        ((Taxonomy)dependantTaxonomies[i]).presentationInfo, out errorList );
                    ((Taxonomy)dependantTaxonomies[i]).presentationInfo = null;
                }

                // now merge against the current presentation
                presentationInfo = MergePresentations( presentationInfo,
                    ((Taxonomy)dependantTaxonomies[0]).presentationInfo, out errorList );
                ((Taxonomy)dependantTaxonomies[0]).presentationInfo = null;
            }

            // nothing to do if there are no inner taxonomies
            //			}
            //if ( presentationInfo != null )
            //{
            //    foreach ( PresentationLink pl in presentationInfo.Values )
            //    {
            //        pl.RemoveRecursiveLocator( ref numErrors );
            //    }
            //}

            if ( numErrors > 0 )
            {
                numPresErrors += numErrors;
                errorList.AddRange( p.ErrorList );
            }
        }