Python'de XBRL dosyası oluşturun

C#‘de XBRL Örneği oluşturun

Aspose.Finance, XBRL belgelerinin oluşturulmasını destekler. Bunun için API, XbrlDocument sınıfını sağlar. XbrlDocument sınıfının varsayılan oluşturucusu, yeni bir XBRL örnek belgesi oluşturmak için kullanılabilir.

Aşağıdaki kod parçacığı, yeni bir XBRL örnek belgesi oluşturmayı gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
xbrlDoc.save(os.path.join(outputDir, "dochavingItem.xbrl"))

Şema referansı ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine şema referansı eklemenizi sağlar. Bunun için API, SchemaRefCollection sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine şema referansı eklemeyi gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
schemaRefs = xbrlInstance.schema_refs
schemaRefs.add(os.path.join(sourceDir, "schema.xsd"), "example", "http://example.com/xbrl/taxonomy")
xbrlDoc.save(os.path.join(outputDir, "dochavingItem.xbrl"))

Bağlam ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine bağlam eklemenizi sağlar. Bunun için API, Context sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine bağlam eklemeyi gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
contextPeriod = ContextPeriod(datetime(2020,1,1), datetime(2020,2,10))
contextEntity = ContextEntity("exampleIdentifierScheme", "exampleIdentifier")
context = Context(contextPeriod, contextEntity)
xbrlInstance.contexts.append(context)
xbrlDoc.save(os.path.join(outputDir, "dochavingItem.xbrl"))

Birim ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine bağlam eklemenizi sağlar. Bunun için API, Unit sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine nasıl birim ekleneceğini gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
unit = Unit(UnitType.MEASURE)
unit.measure_qualified_names.append(QualifiedName("USD", "iso4217", "http://www.xbrl.org/2003/iso4217"))
xbrlInstance.units.append(unit)
xbrlDoc.save(os.path.join(outputDir, "dochavingItem.xbrl"))

Öğe eklemek

Aspose.Finance, yeni oluşturulan XBRL örneğine öğe eklemenizi sağlar. Bunun için API, Item sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine nasıl öğe ekleneceğini gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
schemaRefs = xbrlInstance.schema_refs
schemaRefs.add(os.path.join(sourceDir, "schema.xsd"), "example", "http://example.com/xbrl/taxonomy")
schema = schemaRefs[0]
contextPeriod = ContextPeriod(datetime(2020,1,1), datetime(2020,2,10))
contextEntity = ContextEntity("exampleIdentifierScheme", "exampleIdentifier")
context = Context(contextPeriod, contextEntity)
xbrlInstance.contexts.append(context)
unit = Unit(UnitType.MEASURE)
unit.measure_qualified_names.append(QualifiedName("USD", "iso4217", "http://www.xbrl.org/2003/iso4217"))
xbrlInstance.units.append(unit)
fixedAssetsConcept = schema.get_concept_by_name("fixedAssets")
if fixedAssetsConcept is not None:
item = Item(fixedAssetsConcept)
item.context_ref = context
item.unit_ref = unit
item.precision = 4
item.value = "1444"
xbrlInstance.facts.append(item)
xbrlDoc.save(os.path.join(outputDir, "dochavingItem.xbrl"))

Dipnot bağlantısı ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine bir dipnot bağlantısı eklemenizi sağlar. Bunun için API, FootnoteLink sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine dipnot bağlantısının nasıl ekleneceğini gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
schemaRefs = xbrlInstance.schema_refs
schemaRefs.add(os.path.join(sourceDir, "schema.xsd"), "example", "http://example.com/xbrl/taxonomy")
schema = schemaRefs[0]
contextPeriod = ContextPeriod(datetime(2020,1,1), datetime(2020,2,10))
contextEntity = ContextEntity("exampleIdentifierScheme", "exampleIdentifier")
context = Context(contextPeriod, contextEntity)
xbrlInstance.contexts.append(context)
footnoteLink = FootnoteLink()
footnote = Footnote("footnote1")
footnote.text = "Including the effects of the merger."
loc = Loc("#cd1", "fact1")
footnoteArc = FootnoteArc(loc.label, footnote.label)
footnoteLink.footnotes.append(footnote)
footnoteLink.locators.append(loc)
footnoteLink.footnote_arcs.append(footnoteArc)
xbrlInstance.footnote_links.append(footnoteLink)
xbrlDoc.save(os.path.join(outputDir, "xbrl_sample_with_footnotelink.xbrl"))

Rol referansı ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine bir rol referansı eklemenizi sağlar. Bunun için API, RoleReference sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine nasıl rol referansı ekleneceğini gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
schemaRefs = xbrlInstance.schema_refs
schemaRefs.add(os.path.join(sourceDir, "schema.xsd"), "example", "http://example.com/xbrl/taxonomy")
schema = schemaRefs[0]
roleType = schema.get_role_type_by_uri("http://abc.com/role/link1")
if roleType is not None:
roleReference = RoleReference(roleType)
xbrlInstance.role_references.append(roleReference)
xbrlDoc.save(os.path.join(outputDir, "xbrl_sample_with_roletype.xbrl"))

Ark rol referansı ekle

Aspose.Finance, yeni oluşturulan XBRL örneğine bir yay rolü referansı eklemenizi sağlar. Bunun için API, ArcroleReference sınıfını sağlar.

Aşağıdaki kod parçacığı, yeni oluşturulan bir XBRL örneğine bir yay rolü referansının nasıl ekleneceğini gösterir.

xbrlDoc = XbrlDocument()
xbrlInstances = xbrlDoc.xbrl_instances
xbrlInstance = xbrlInstances[xbrlInstances.add()]
schemaRefs = xbrlInstance.schema_refs
schemaRefs.add(os.path.join(sourceDir, "schema.xsd"), "example", "http://example.com/xbrl/taxonomy")
schema = schemaRefs[0]
arcroleType = schema.get_arcrole_type_by_uri("http://abc.com/arcrole/footnote-test")
if arcroleType is not None:
arcroleReference = ArcroleReference(arcroleType)
xbrlInstance.arcrole_references.append(arcroleReference)
xbrlDoc.save(os.path.join(outputDir, "xbrl_sample_with_arcroletype.xbrl"))