public void TestUsGaap2008_ci_all() { //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) ); string fileName = @"S:\2009PublicReview\ind\ci\ssss.xsd"; Taxonomy s = new Taxonomy(); int errors = 0; DateTime start = DateTime.Now; if (s.Load(fileName, out errors) != true) { Assert.Fail((string)s.ErrorList[0]); } s.Parse(out errors); Assert.IsNotNull((s.allElements["dei_DocumentType"] as Element).EnumData, "enum data should not be null"); }
public void TestUkCompanies_Instances() { Taxonomy tax = new Taxonomy(); int errors = 0; DateTime start = DateTime.Now; if ( tax.Load( COMPANIES_HOUSE_FILE, out errors ) != true ) { Assert.Fail( (string)tax.ErrorList[0]); } errors = 0; // this loads up all dependant taxonomies, and loads the corresponding presentation, calculation, label, and reference linkbases // parse presentation first tax.CurrentLabelRole ="preferredLabel"; tax.CurrentLanguage = "en"; tax.Parse( out errors ); Assert.AreEqual( 0, errors, "should not have any errors"); Hashtable prefixXRef = new Hashtable(); prefixXRef["ae"] = "uk-gaap-ae"; prefixXRef["pt"] = "uk-gaap-pt"; prefixXRef["gc"] = "uk-gcd"; ValidateInstanceDoc( tax, DAMC_INST_FILE, 0,prefixXRef ); ValidateInstanceDoc( tax, DAMC_INST_FILE_Missing_Item, 2, prefixXRef); ValidateInstanceDoc( tax, DAM_INST_FILE, 0,prefixXRef ); ValidateInstanceDoc( tax, DAM_INST_FILE_Missing_Item, 1,prefixXRef ); }
public void TestSaveToLocalApplicationData() { string fileName = AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2005-02-28.xsd"; if (File.Exists(fileName)) { File.Delete(fileName); } fileName = AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-ptr-2005-02-28.xsd"; if (File.Exists(fileName)) { File.Delete(fileName); } Taxonomy tx = new Taxonomy(); int errors = 0; DateTime start = DateTime.Now; Assert.AreEqual( true, tx.Load( "http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd", out errors ), "Could not load US GAAP File" ); Assert.AreEqual( 0, errors ); tx.Parse(out errors); DateTime end = DateTime.Now; Console.WriteLine( "Parse Time: {0}", end-start ); fileName = AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2005-02-28.xsd"; Assert.IsTrue(File.Exists(fileName)); fileName = AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-ptr-2005-02-28.xsd"; Assert.IsTrue(File.Exists(fileName)); }
public void Dow_ParseUsingCloneOfBaseTaxonomy() { DateTime start = DateTime.Now; DOW_LoadAndParse(); DateTime end = DateTime.Now; Console.WriteLine("TIME TAKEN TO LOAD WITHOUT CACHE = {0}", end - start); string US_GAAP_FILE = TestCommon.FolderRoot + @"XBRL 2.1 Updated" +System.IO.Path.DirectorySeparatorChar +"2005-02-28" +System.IO.Path.DirectorySeparatorChar +"us-gaap-ci-2005-02-28.xsd"; Taxonomy bt = new Taxonomy(); bt.Load(US_GAAP_FILE); int errors = 0; bt.Parse(out errors); bt.CurrentLabelRole = "Label"; bt.CurrentLanguage = "en"; ArrayList nodeList = bt.GetNodesByPresentation(); MemoryStream msWrite = new MemoryStream(); BinaryFormatter formatterWrite = new BinaryFormatter(); formatterWrite.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; formatterWrite.Serialize(msWrite, bt); byte[] bufOrig = msWrite.GetBuffer(); ArrayList flatListOrig = new ArrayList(); TestTaxonomy_US_GAAP_IM.GetFlatListOfPresentationNodes(nodeList, ref flatListOrig); Hashtable taxIdInfos = new Hashtable(); for (int i = 0; i < flatListOrig.Count; i++) { Node orig = flatListOrig[i] as Node; if( orig.MyElement != null ) { taxIdInfos[orig.Id] = orig.MyElement.TaxonomyInfoId; } } taxonomyCache[Path.GetFileName(US_GAAP_FILE)] = bt; Taxonomy.TaxonomyCacheManager = this; start = DateTime.Now; DOW_LoadAndParse(); end = DateTime.Now; Console.WriteLine("TIME TAKEN TO LOAD WITH CACHE = {0}", end - start); ArrayList nodeListAfter = bt.GetNodesByPresentation(); ArrayList flatListAfter = new ArrayList(); TestTaxonomy_US_GAAP_IM.GetFlatListOfPresentationNodes(nodeListAfter, ref flatListAfter); Assert.AreEqual(flatListOrig.Count, flatListAfter.Count, "should not change"); for (int i = 0; i < flatListAfter.Count; i++) { Node orig = flatListOrig[i] as Node; Node after = flatListAfter[i] as Node; Assert.AreEqual(orig.Label, after.Label, "Label should match"); Assert.AreEqual(orig.Id, after.Id); if (after.MyElement != null) { Assert.AreEqual(taxIdInfos[after.Id], after.MyElement.TaxonomyInfoId); } } Taxonomy.TaxonomyCacheManager = null; msWrite = new MemoryStream(); formatterWrite = new BinaryFormatter(); formatterWrite.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; formatterWrite.Serialize(msWrite, bt); byte[] bufAfter = msWrite.GetBuffer(); Assert.AreEqual(bufOrig.Length, bufAfter.Length, "Cache object has changed"); MemoryStream msRead = new MemoryStream(bufOrig); BinaryFormatter formatterRead = new BinaryFormatter(); formatterRead.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; Taxonomy origbt = formatterRead.Deserialize(msRead) as Taxonomy; Assert.AreEqual(origbt.AllElements.Count, bt.AllElements.Count); //for( int i = 0 ;i < bufAfter.Length ; i++ ) //{ // if (bufAfter[i] != bufOrig[i]) // { // Console.WriteLine("Position that is not correct = {0} out of total = {1}" ,i, bufAfter.Length); // } // Assert.AreEqual(bufAfter[i], bufOrig[i], "binary data is different"); //} }
public void TestSaveToLocalApplicationData() { Taxonomy tx = new Taxonomy(); int errors = 0; DateTime start = DateTime.Now; // we only save to local app data if it's a web file location... Assert.AreEqual( true, tx.Load( US_GAAP_WEB_FILE, out errors ), "Could not load US GAAP File" ); Assert.AreEqual( 0, errors ); tx.Parse(out errors); DateTime end = DateTime.Now; Console.WriteLine( "Parse Time: {0}", end-start ); FileInfo fi = null; // Expecting 10 files to copy over... // 1. usfr-pte-2005-02-28.xsd fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-pte-2005-02-28.xsd" ); Assert.IsTrue(fi.Exists, "File not found: " + fi.Name); // 2. usfr-pte-2005-02-28-label.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-pte-2005-02-28-label.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 3. usfr-pte-2005-02-28-presentation.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-pte-2005-02-28-presentation.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 4. usfr-pte-2005-02-28-reference.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-pte-2005-02-28-reference.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 5. usfr-ptr-2005-02-28.xsd fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-ptr-2005-02-28.xsd" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 6. usfr-ptr-2005-02-28-calculation.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-ptr-2005-02-28-calculation.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 7. usfr-ptr-2005-02-28-presentation.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "usfr-ptr-2005-02-28-presentation.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 8. us-gaap-ci-2005-02-28.xsd fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2005-02-28.xsd" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 9. us-gaap-ci-2005-02-28-calculation.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2005-02-28-calculation.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); // 10. us-gaap-ci-2005-02-28-presentation.xml fi = new FileInfo( AucentGeneral.RivetApplicationDataDragonTagPath + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-2005-02-28-presentation.xml" ); Assert.IsTrue( fi.Exists, "File not found: " + fi.Name ); }
private void MutualFundTaxonomyLoad() { string fileName = @"Q:\Taxonomies\Fidelity.xsd"; DateTime start = DateTime.Now; Taxonomy tax = new Taxonomy(); tax.Load(fileName); int error; Assert.IsTrue(tax.Parse(out error)); tax.GetNodesByPresentation(true); List<DimensionNode> dNodes = new List<DimensionNode>(); Assert.IsTrue(tax.TryGetAllDimensionNodesForDisplay(null, null, true, out dNodes)); DateTime end = DateTime.Now; Console.WriteLine("Time taken = {0}", end - start); Element ele = tax.allElements["rr_MaximumAccountFeeOverAssets"] as Element; object notUsed = null; string errorStr; Assert.IsTrue( ele.TryValidateElement("0.62%", ref notUsed , out errorStr)); }
public void TestPerformSECValidations3() { Taxonomy tax = new Taxonomy(); tax.Load(@"S:\TESTSCHEMAS\EIX Taxonomy\eix.xsd"); int errors; Assert.IsTrue(tax.Parse(out errors), "Failed to parse taxonomy"); Dictionary<string, bool> eleDt = new Dictionary<string, bool>(); List<MarkupProperty> validMarkups = new List<MarkupProperty>(); List<ValidationErrorInfo> outParam = new List<ValidationErrorInfo>(); tax.PerformSECValidations(validMarkups, eleDt, null, false, ref outParam); outParam.Sort(); foreach (ValidationErrorInfo vei in outParam) { Console.WriteLine(vei.MyErrorString); } }
public void TestLoadICI_RR_Taxonomy_WithPrompt() { Taxonomy iciTaxonomy = new Taxonomy(); int numErrors; Assert.IsTrue(iciTaxonomy.Load(ICI_RR_SCHEMAFILE, out numErrors), "Failed to load ICI-RR Taxonomy. " + numErrors + " errors were found"); Assert.IsTrue(iciTaxonomy.Parse(out numErrors), "Failed to parse the ICI-RR Taxonomy: " + numErrors + " errors were found"); }
public void TestPerformSECValidations1() { Taxonomy tax = new Taxonomy(); tax.Load(@"S:\TESTSCHEMAS\FMC Taxonomy\fmc-20090930.xsd"); int errors; Assert.IsTrue(tax.Parse(out errors), "Failed to parse taxonomy"); Dictionary<string, bool> eleDt = new Dictionary<string,bool>(); eleDt.Add( "us-gaap_Revenues", true ); List<ValidationErrorInfo> outParam = new List<ValidationErrorInfo>(); tax.PerformSECValidations(null, eleDt, null, false, ref outParam); }
public void TestPerformSECValidations2() { Taxonomy tax = new Taxonomy(); tax.Load(@"S:\TESTSCHEMAS\BEN Taxonomy\ben-20091231.xsd"); int errors; Assert.IsTrue(tax.Parse(out errors), "Failed to parse taxonomy"); Instance ins = new Instance(); ArrayList errorsstr; Assert.IsTrue(ins.TryLoadInstanceDoc(@"S:\TESTSCHEMAS\BEN Taxonomy\ben-20091231.xml", out errorsstr)); Dictionary<string, bool> eleDt = new Dictionary<string,bool>(); List<MarkupProperty> validMarkups = new List<MarkupProperty>(); foreach (MarkupProperty mp in ins.markups) { mp.element = new Node( tax.allElements[mp.elementId] as Element); eleDt[mp.elementId] = true; validMarkups.Add(mp); } List<ValidationErrorInfo> outParam = new List<ValidationErrorInfo>(); tax.PerformSECValidations(validMarkups, eleDt, null, false, ref outParam); outParam.Sort(); foreach( ValidationErrorInfo vei in outParam ) { Console.WriteLine( vei.MyErrorString); } }
public void TestKoreanTaxonomy() { Taxonomy tax = new Taxonomy(); tax.Load(@"S:\TestSchemas\KoreanTest\xbrl03382-2008-04-23-ci.xsd"); int errors; Assert.IsTrue(tax.Parse(out errors), "Failed to parse taxonomy"); }
public void TestGetNodeByPath() { int numErrors; Taxonomy tax = new Taxonomy(); tax.Load(@"http://www.xbrl.org/us/fr/gaap/ci/2005-02-28/us-gaap-ci-2005-02-28.xsd"); tax.Parse(out numErrors); tax.currentLabelRole = "label"; tax.currentLanguage = "en"; ArrayList nodes = tax.GetNodesByPresentation(true); Node n = nodes[2] as Node; //Income Statement root node n = n.children[0] as Node; //Income & Expense abstarct node n = n.children[1] as Node; //Cost of Goods and Services Sold n = n.children[1] as Node; // Cost of Services Sold n = n.children[5] as Node; // Cost of Services - Total string path = n.GetPresentationPath(); Node testNode = tax.GetNodeFromPresentation(path, true); Assert.IsNotNull(testNode, "Failed to get node from presentation using path"); Assert.AreEqual(n, testNode, "Incorrect node returned by GetNodeFromPresentation"); }
public void TestCustomDataTypesLoading() { Taxonomy tax = new Taxonomy(); int numErrors; string pathToUse = @"S:\TESTSCHEMAS\TestTypesIn2011\sdds.xsd"; if (tax.Load(pathToUse, out numErrors)) { if (tax.Parse(out numErrors)) { foreach (KeyValuePair<string, string> kvp in tax.GetSimpleCustomElementTypes()) { Console.WriteLine("{0} - {1}", kvp.Key, kvp.Value); } } } }
public static bool TryLoadTaxonomy( string taxonomyPath, RequestCacheLevel remoteFileCachePolicy, //XmlCatalogResolver xmlCatalog, out Taxonomy currentTaxonomy, out int numberErrors, out string errorMsg) { errorMsg = string.Empty; currentTaxonomy = new Taxonomy(); currentTaxonomy.PromptUser = false; currentTaxonomy.CachePolicy = remoteFileCachePolicy; //currentTaxonomy.XmlCatalog = xmlCatalog; try { numberErrors = currentTaxonomy.Load(taxonomyPath, false); if (numberErrors == 0) { currentTaxonomy.Parse(out numberErrors); } } catch (XPathException) { numberErrors = 1; errorMsg = "Error parsing the taxonomy: Unable to find one or more of the dependent taxonomy files for taxonomy " + taxonomyPath; return false; } // ignore calc linkbase errors - don'care if (numberErrors != 0 && currentTaxonomy.ErrorList.Count > 0) { Console.WriteLine( " Pres Errors: " + currentTaxonomy.NumPresErrors ); Console.WriteLine( " Calc Errors: " + currentTaxonomy.NumCalcErrors ); Console.WriteLine( " Label Errors: " + currentTaxonomy.NumLabelErrors ); Console.WriteLine( " Reference Errors: " + currentTaxonomy.NumReferenceErrors ); currentTaxonomy.ErrorList.Sort(); try { foreach ( ParserMessage pm in currentTaxonomy.ErrorList ) { if ( pm.Level != TraceLevel.Error ) { break; // all the errors should be first after sort } errorMsg += pm.Message + Environment.NewLine; Console.WriteLine( pm.Level.ToString() + ": " + pm.Message ); } errorMsg = "Error parsing the taxonomy: "+ errorMsg.Trim(); } //Do nothing. Error wasn't written to the event log. catch { } // don't care about calc errors - if it's anything else, bomb out if ( numberErrors != currentTaxonomy.NumCalcErrors ) { return false; } } return true; }
public void TestPerformSECValidations_TMP() { Taxonomy tax = new Taxonomy(); tax.Load(@"C:\Crossfire Stuff\us-gaap-2011-01-31\us-gaap-2011-01-31\ind\ci\testing.xsd"); int errors; Assert.IsTrue(tax.Parse(out errors), "Failed to parse taxonomy"); Dictionary<string, bool> eleDt = new Dictionary<string, bool>(); eleDt.Add("us-gaap_AccountsPayableAndAccruedLiabilities", true); eleDt.Add("us-gaap_AccountsPayable",true); List<ValidationErrorInfo> outParam = new List<ValidationErrorInfo>(); tax.PerformSECValidations(null, eleDt, null, false, ref outParam); }
public void Test_us_gaap_ci_stm_dis_all_2007_12_31() { string fileName = TestCommon.FolderRoot + @"USFRTF-2007-11-21-prerelease\ind\ci" + System.IO.Path.DirectorySeparatorChar + "us-gaap-ci-stm-dis-all-2007-12-31.xsd"; Taxonomy s = new Taxonomy(); int errors = 0; DateTime startLoad = DateTime.Now; DateTime startLoadParse = DateTime.Now; if (s.Load(fileName, out errors) != true) { Assert.Fail((string)s.ErrorList[0]); } DateTime endLoad = DateTime.Now; DateTime startParse = DateTime.Now; s.Parse(out errors); DateTime endParse = DateTime.Now; DateTime endLoadParse = DateTime.Now; s.CurrentLanguage = "en"; s.CurrentLabelRole = "preferredLabel"; long FileSize = new long(); DateTime startSerialize = DateTime.Now; Taxonomy.Serialize(s, @"C:\Aucent\TaxonomySerialized.bin", out FileSize); DateTime endSerialize = DateTime.Now; //Taxonomy sNew = new Taxonomy(); //DateTime startDeserialize = DateTime.Now; //Taxonomy.Deserialize(@"C:\Aucent\TaxonomySerialized.bin", out sNew); //DateTime endDeserialize = DateTime.Now; DateTime startGetNodes = DateTime.Now; ArrayList nodes = s.GetNodesByPresentation(true); DateTime endGetNodes = DateTime.Now; //ArrayList nodesNew = sNew.GetNodesByPresentation(true); //int count = 0; //int dimensionNodeCount = 0; //foreach (Node n in nodes) //{ // StringBuilder sb = DisplayNode(n, 0, ref count, ref dimensionNodeCount); // Console.WriteLine(sb.ToString()); //} //int countNew = 0; //int dimensionNodeCountNew = 0; //foreach (Node n in nodesNew) //{ // StringBuilder sb = DisplayNode(n, 0, ref countNew, ref dimensionNodeCountNew); // Console.WriteLine(sb.ToString()); //} Console.WriteLine("Time to Load: {0}", endLoad - startLoad); Console.WriteLine("Time to Parse: {0}", endParse - startParse); Console.WriteLine("Time to Load/Parse: {0}", endLoadParse - startLoadParse); Console.WriteLine("Time to Serialize: {0}", endSerialize - startSerialize); //Console.WriteLine("Time to Deserialize: {0}", endDeserialize - startDeserialize); Console.WriteLine("Time to GetNodes: {0}", endGetNodes - startGetNodes); Console.WriteLine("Serialized Filesize: {0}", FileSize); //Console.WriteLine("Count of elements in original presentation = {0}", count); //Console.WriteLine("Count of elements in deserialized presentation = {0}", countNew); }
public void TestRemoteFileInformationCache() { RemoteFiles.RemoteFileInformation.LoadRemoteFileInformation(); List<string> taxonomyListToLoad = new List<string>(); taxonomyListToLoad.Add(@"S:\TESTSCHEMAS\TaxonomyConversionTest1\etp-taxonomy.xsd"); taxonomyListToLoad.Add(@"S:\TESTSCHEMAS\TaxonomyConversionTest1\tmp\etp-taxonomy.xsd"); taxonomyListToLoad.Add("http://xbrl.sec.gov/rr/2010/rr-entire-2010-02-28.xsd"); //2009 taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/ind/ci/us-gaap-ci-stm-dis-all-2009-01-31.xsd"); taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/ind/basi/us-gaap-basi-stm-dis-all-2009-01-31.xsd"); taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/ind/bd/us-gaap-bd-stm-dis-all-2009-01-31.xsd"); taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/ind/ins/us-gaap-ins-stm-dis-all-2009-01-31.xsd"); taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/ind/re/us-gaap-re-stm-dis-all-2009-01-31.xsd"); taxonomyListToLoad.Add("http://taxonomies.xbrl.us/us-gaap/2009/non-gaap/dei-ent-all-2009-01-31.xsd"); //2011 taxonomyListToLoad.Add("http://xbrl.fasb.org/us-gaap/2011/ind/ci/us-gaap-ci-stm-dis-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.fasb.org/us-gaap/2011/ind/basi/us-gaap-basi-stm-dis-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.fasb.org/us-gaap/2011/ind/bd/us-gaap-bd-stm-dis-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.fasb.org/us-gaap/2011/ind/ins/us-gaap-ins-stm-dis-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.fasb.org/us-gaap/2011/ind/re/us-gaap-re-stm-dis-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.sec.gov/dei/2011/dei-ent-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.sec.gov/invest/2011/invest-ent-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://xbrl.sec.gov/country/2011/country-ent-all-2011-01-31.xsd"); taxonomyListToLoad.Add("http://www.xbrl.org/lrr/role/negated-2009-12-16.xsd"); taxonomyListToLoad.Add("http://www.xbrl.org/lrr/role/net-2009-12-16.xsd"); foreach (string str in taxonomyListToLoad) { Taxonomy tax = new Taxonomy(); tax.Load(str); int error; Assert.IsTrue(tax.Parse(out error)); } }
public void TestLoadICI_RR_Taxonomy() { Taxonomy iciTaxonomy = new Taxonomy(); int numErrors = iciTaxonomy.Load(ICI_RR_SCHEMAFILE, false); Assert.AreEqual(0, numErrors, "Failed to load ICI-RR Taxonomy. " + numErrors + " errors were found"); Assert.IsTrue(iciTaxonomy.Parse(out numErrors), "Failed to parse the ICI-RR Taxonomy: " + numErrors + " errors were found"); }
public void Create2011URLMapping() { Taxonomy tax = new Taxonomy(); int numErrors; string pathToUse = "http://xbrl.fasb.org/us-gaap/2011/entire/us-gaap-entryPoint-all-2011-01-31.xsd"; if (tax.Load(pathToUse, out numErrors)) { if (tax.Parse(out numErrors)) { //get all the file URL mappings... Dictionary<string, string> fileUrlMap = tax.BuildTaxonomyUrlMappings(); RemoteFiles.UpdateTaxonomyURLMappingInfo(fileUrlMap); } } }
public void TestCheckIsTextBlock() { //The original type is wrong, but the element name is right Element child1 = Element.CreateElement( DataTypeCode.String, "us-gaap_MortgageLoansOnRealEstateWriteDownOrReserveDisclosureTextBlock", true, PeriodType.duration ); child1.OrigElementType = "xbrli:stringItemType"; bool test1 = child1.IsTextBlock(); Assert.IsTrue( test1 ); //The original type is right child1 = Element.CreateElement( DataTypeCode.String, "child1", true, PeriodType.duration ); child1.OrigElementType = TEXT_BLOCK_ITEM_TYPE; bool test2 = child1.IsTextBlock(); Assert.IsTrue( test2 ); //Close, but not the same - should be false child1 = Element.CreateElement( DataTypeCode.String, "us-gaap_MortgageLoansOnRealEstateWriteDownOrReserveDisclosureTextBloc", true, PeriodType.duration ); child1.OrigElementType = "xbrli:stringItemType"; bool test3 = child1.IsTextBlock(); Assert.IsFalse( test3 ); //Not even close... child1 = Element.CreateElement( DataTypeCode.String, "us-gaap", true, PeriodType.duration ); child1.OrigElementType = "xbrli:positiveIntegerItemType"; bool test4 = child1.IsTextBlock(); Assert.IsFalse( test4 ); //Check a real element string fileName = "http://xbrl.us/us-gaap/1.0/ind/ci/us-gaap-ci-stm-2008-03-31.xsd"; int errors = 0; Taxonomy s = new Taxonomy(); if( s.Load( fileName, out errors ) != true ) { Assert.Fail( (string)s.ErrorList[ 0 ] ); } s.Parse( out errors ); Element child2 = s.allElements[ "us-gaap_MortgageLoansOnRealEstateWriteDownOrReserveDisclosureTextBlock" ] as Element; bool test5 = child2.IsTextBlock(); Assert.IsTrue( test5 ); child2 = s.allElements[ "us-gaap_AccountingChangesAndErrorCorrectionsTextBlock" ] as Element; bool test6 = child2.IsTextBlock(); Assert.IsTrue( test6 ); child2 = s.allElements["us-gaap_BankruptcyClaimsNumberClaimsFiled"] as Element; object parsed = new object(); string err; Assert.IsTrue(child2.TryValidateElement("1,000", ref parsed, out err), "Should be valid"); }
private void LoadRRTaxonomy() { string fileName = @"http://xbrl.sec.gov/rr/2010/rr-entire-2010-02-28.xsd"; DateTime start = DateTime.Now; Taxonomy tax = new Taxonomy(); tax.Load(fileName); int error; Assert.IsTrue(tax.Parse(out error)); }