Skip to content

Instantly share code, notes, and snippets.

@aspose-finance-gists
Created October 25, 2022 19:17
Show Gist options
  • Select an option

  • Save aspose-finance-gists/00331a81b22c710620e189f929fbcd30 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-finance-gists/00331a81b22c710620e189f929fbcd30 to your computer and use it in GitHub Desktop.

Revisions

  1. aspose-finance-gists created this gist Oct 25, 2022.
    7 changes: 7 additions & 0 deletions Validate-XBRL-in-Python.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Learn **how to validate an XBRL document in Python** : https://blog.aspose.com/finance/validate-xbrl-document-in-python/

    The following topics are covered in this article:

    1. [Python XBRL Validator API to Validate XBRL Document](https://blog.aspose.com/finance/validate-xbrl-document-in-python/#Python-XBRL-Validator-API-to-Validate-XBRL-Documents)
    2. [Validate XBRL File](https://blog.aspose.com/finance/validate-xbrl-document-in-python/#Validate-XBRL-File-in-Python)
    3. [Validate Inline XBRL File](https://blog.aspose.com/finance/validate-xbrl-document-in-python/#Validate-iXBRL-File-in-Python)
    16 changes: 16 additions & 0 deletions Validate-XBRL-in-Python_ixbrl.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # This code example demonstrates how to validate Inline XBRL document.
    from aspose.finance.xbrl.inline import InlineXbrlDocument

    # The path to the input document
    inputFile = "C:\Files\sample.html"

    # Load XBRL file
    document = InlineXbrlDocument(inputFile)

    # Validate
    document.validate();

    # Show validation errors if any
    if document.validation_errors.length > 0:
    for validationError in document.validation_errors:
    print(validationError.message)
    22 changes: 22 additions & 0 deletions Validate-XBRL-in-Python_xbrl.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # This code example demonstrates how to validate XBRL instance document.
    from aspose.finance.xbrl import XbrlDocument

    # The path to the input document
    inputFile = "C:\Files\sample.xbrl"

    # Load XBRL file
    document = XbrlDocument(inputFile)

    # Get instances
    xbrlInstances = document.xbrl_instances

    # Select specific instance
    xbrlInstance = xbrlInstances[0]

    # Validate
    xbrlInstance.validate()

    # Show validation errors if any
    if xbrlInstance.validation_errors.length > 0:
    for validationError in xbrlInstance.validation_errors:
    print(validationError.message)