public void testXPELoadFile() { if (initXPE()) { //Preload a taxonomy var xbrlTax = Xbrl.newInstance(); if (xbrlTax.load("http://emisnet.bmv.com.mx/taxonomy/mx-ifrs-2014-12-05/full_ifrs_mc_mx_ics_entry_point_2014-12-05.xsd", true, true)) { xbrlTax.compileFormulas(); LoadAndValidate("C:\\temp\\load\\ifrsxbrl_DAIMLER_2015-2.xbrl"); LoadAndValidate("C:\\temp\\load\\ifrsxbrl_DAIMLER_2015-2_1.xbrl"); xbrlTax.close(); xbrlTax.Shutdown(); } else { foreach (var memo in xbrlTax.getMemos()) { Debug.WriteLine(memo); } } } }
private bool initXPE() { Xbrl xbrlProc = null; try { var configInstance = Configuration.getInstance(); configInstance.setCoreRoot("C:\\coreroot"); var lang = "en"; var _coreroot = configInstance.getCoreRoot(); configInstance.setProperty(Configuration.c_logging, "false"); configInstance.setFormulaUnsatisfiedEvaluationThreshold(100); configInstance.setMemosErrorThreshold(100); configInstance.setProperty("extensionFunctionModuleLogicalUri", ""); configInstance.setProperty("extensionFunctionModuleClassUri", ""); configInstance.setModel(Configuration.s_fullModel); configInstance.setMode(Configuration.s_desktopMode); xbrlProc = Xbrl.newInstance(); configInstance.setLanguage(lang); var errors = new List <IMemo>(); Debug.WriteLine("COREROOT:" + _coreroot); try { configInstance.clearWebCache(); configInstance.clearXPathExpressionCache(); } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); } this.m_formatter = new ubmatrix.xbrl.common.formatter.src.Formatter(); this.m_resolver = new ubmatrix.xbrl.common.memo.uriResolver.src.URIResolver(); if (!xbrlProc.Initialize()) { if (xbrlProc.getNativeMemos() != null) { foreach (var memo in xbrlProc.getMemos()) { Debug.WriteLine(memo); } } return(false); } } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); return(false); } return(true); }
private void LoadAndValidate(string fileToLoad) { Debug.WriteLine("Loading and Validating:" + fileToLoad); var xbrlDocIns = Xbrl.newInstance(); var sw = Stopwatch.StartNew(); if (xbrlDocIns.load(fileToLoad, true, true)) { sw.Stop(); Debug.WriteLine("Load time:" + sw.ElapsedMilliseconds); sw.Restart(); if (xbrlDocIns.validate(getValidationOptions())) { sw.Stop(); Debug.WriteLine("Validation time:" + sw.ElapsedMilliseconds); foreach (var memo in xbrlDocIns.getMemos()) { Debug.WriteLine(memo); } sw.Restart(); var config = new FormulaConfiguration(); config.setKeepResultDTSOpenFlag(false); if (xbrlDocIns.processFormulas(config, null, null, null)) { sw.Stop(); Debug.WriteLine("Formula time:" + sw.ElapsedMilliseconds); var assertions = config.getResult().getAssertionResults(); while (assertions.hasNext()) { Object asResult = ((Map.Entry)assertions .next()).getValue(); ProcessAssertionResult(asResult); } } else { sw.Stop(); Debug.WriteLine("Formula time:" + sw.ElapsedMilliseconds); foreach (var memo in xbrlDocIns.getMemos()) { Debug.WriteLine(memo); } } } else { Debug.WriteLine("Failed to validate"); foreach (var memo in xbrlDocIns.getMemos()) { Debug.WriteLine(memo); } } xbrlDocIns.close(); } else { Debug.WriteLine("Failed to load"); foreach (var memo in xbrlDocIns.getMemos()) { Debug.WriteLine(memo); } } }