RaptorXML Python API v2.6 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.xpath).

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.5.

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.

Indices and tables