RaptorXML Python API v2.9 documentation

Supported specifications

The RaptorXML+XBRL Server Python API has support for the following specifications:

The RaptorXML+XBRL Server Python API provides access the internal data model of Altova RaptorXML+XBRL Server for DTD, XML, XML Schema, XBRL and documents.

BETA API modules

The API for the modules in the beta scope may change without notice. The implementation of these modules is stable but the API may still change. They will move to global scope when the API is stable. To import these modules add a beta. prefix to the module name (e.g. beta.xbrl.xule).

Getting Started

RaptorXML supports the Python scripting language
  • through Python callback functions that are invoked after a job is finished

  • by starting as the custom RaptorXML python interpreter raptorxml-python (new since release 2016).

Both methods include support for the entire RaptorXML Python API.

Python version

User-created Python scripts must conform to Python 3.11.

RaptorXML Python API versions

The current RaptorXML Python API version is 2.9.0 (default for --script-api-version in release 2024). The default RaptorXML Python API version is always the current version at the time of the release. For Python callback scripts a different RaptorXML Python API version may be chosen by the --script-api-version command line option. For the custom interpreter raptorxml-python the RaptorXML Python API major version can be selected through the import altova_api.v1 or import altova_api.v2 Python statements.

Supported Python API Callbacks

The API can be used through callback functions which are implemented in a Python script file. See Executing Python Scripts through callback from RaptorXML. The callback functions are invoked not only if validation succeeds, but also if validation fails.

on_xsi_finished(job, instance)

This function is called after the command valxml-withxsd --streaming=false (xsi) has finished validating the instance document. The arguments are

on_dtd_finished(job, dtd)

This function is called after the command valdtd (dtd) has finished validating the DTD document(s). The arguments are

(since API v2.1)

on_xsd_finished(job, schema)

This function is called after the command valxsd (xsd) has finished validating the schema document(s). The arguments are

on_dts_finished(job, dts)

This function is called after the command valdts (dts) has finished validating the DTS. The arguments are

on_xbrl_finished(job, instance)

This function is called after the command valxbrl (xbrl) has finished validating the XBRL instance document. The arguments are

on_ixbrl_finished(job, document-set, target-documents)

This function is called after the command valinlinexbrl (ixbrl) has finished transforming the Inline XBRL Document Set. The arguments are

  • job of type xbrl.Job

  • document-set of type list containing xml.Instance objects that represent the XML Infoset of the Inline XBRL Document Set documents

  • target-documents of type dict containing xml.Instance objects indexed by the target property or None if the Inline XBRL transformation failed

A Python script file is specified with the --script option on the command line. In case of failed validation the errors are stored in xml.Job.error_log. Script parameters for the above callback functions can be specified on the command line using the --script-param="KEY:VALUE" option. The --script-param option can be specified multiple times. The specified script parameters are accessible in the xml.Job.script_params dictionary.

Modules

Indices and tables