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.
Validate XBRL Document in Python | Python XBRL Validator API
# 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)
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment