Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-kb/38aa9af940b42c1022078cb3c80f02e7 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/38aa9af940b42c1022078cb3c80f02e7 to your computer and use it in GitHub Desktop.
Extract Data From XBRL and iXBRL files in C#: The related step by step guide can be found here: https://kb.aspose.com/finance/net/how-to-extract-data-from-xbrl-file-in-c-sharp/
using System;
using System.Collections.Generic;
//Add reference to Aspose.Finance for .NET API
//Use below namespaces to extract data from XBRL file
using Aspose.Finance;
using Aspose.Finance.Xbrl;
using Aspose.Finance.Xbrl.Dom;
using Aspose.Finance.Xbrl.Inline;
namespace ExtractDataFromXBRLFile
{
class Program
{
static void Main(string[] args)
{
//Set Aspose license before extracting data from XBRL file
//using Aspose.Finance for .NET
Aspose.Finance.License AsposeFinanceLicense = new Aspose.Finance.License();
AsposeFinanceLicense.SetLicense(@"c:\asposelicense\license.lic");
//load XBRL document
InlineXbrlDocument XBRLDocument = new InlineXbrlDocument("InputXBRLDataFile.html");
//retrieve XBRL document contents
NodeList childNodes = XBRLDocument.ChildNodes;
Node firstChild = XBRLDocument.FirstChild;
List<InlineFootnote> footNotes = XBRLDocument.Footnotes;
List<InlineFact> inlineFacts = XBRLDocument.Facts;
List<Context> contexts = XBRLDocument.Contexts;
List<Unit> units = XBRLDocument.Units;
//further use the XBRL document information
foreach (InlineFact fact in inlineFacts)
{
Console.WriteLine("Fact: {0}", fact.Name);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment