RaptorXML Python API v2.8 documentation¶
Supported specifications¶
- The RaptorXML+XBRL Server Python API has support for the following specifications:
JSON (see API module
json
)JSON Schema (see API module
json.schema
)OASIS XML Catalog 1.1 (see
xml.Catalog
)XML Information Set (see API module
xml
)XMLSchema 1.0 and XMLSchema 1.1 (see API module
xsd
)XBRL 2.1 (see API modules
xbrl
andxbrl.taxonomy
)XBRL Dimensions 1.0 (see API module
xbrl.xdt
)XBRL Formula 1.0 (see API module
xbrl.formula
)XBRL Table 1.0 (see API module
xbrl.table
)XBRL Extensible Enumerations 1.0
XBRL Generic Links 1.0
XBRL Generic Labels 1.0
XBRL Generic References 1.0
XBRL XULE 1.0 (see
beta.xbrl.xule
)Inline XBRL 1.0 and 1.1 (see
xbrl.InlineXBRLDocumentSet
)Taxonomy Packages 1.0 (see
xbrl.taxonomy.TaxonomyPackage
)AVRO (see
avro
andavro.schema
)XPath 3.1 (see
beta.xpath
)XSLT 3.0 (see
beta.xslt
)XQuery 3.1 (see
beta.xquery
)
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.7.
RaptorXML Python API versions¶
The current RaptorXML Python API version is 2.8.4 (default for --script-api-version
in release 2022r2).
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.
- Executing Python Scripts through callback from RaptorXML
- Executing Python Scripts through raptorxml-python
- Example Scripts
- Altova RaptorXML+XBRL API Tutorial
- Introduction
- Executing scripts in RaptorXML
- Importing Altova modules
- Installing thrid party modules
- Loading XBRL instances
- Processing multiple XBRL instances (in parallel)
- Retrieving facts
- Finding facts by aspect values
- Implicit filtering
- Working with facts
- DTS
- Taxonomy concepts
- Networks of relationships
- Listing available linkroles
- Display presentation trees
- Display calculation trees
- Dimensional Relationship Set
- CSV export
- XSLX export
- SQLite export
- SEC filing analysis with RaptorXML
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 arejob of type
xml.Job
instance of type
xml.Instance
orNone
if the validation failed
-
on_dtd_finished
(job, dtd)¶ This function is called after the command
valdtd
(dtd) has finished validating the DTD document(s). The arguments arejob of type
xml.Job
dtd of type
xml.dtd.DTD
orNone
if the validation failed
(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 arejob of type
xml.Job
schema of type
xsd.Schema
orNone
if the validation failed
-
on_dts_finished
(job, dts)¶ This function is called after the command
valdts
(dts) has finished validating the DTS. The arguments arejob of type
xbrl.Job
dts of type
xbrl.taxonomy.DTS
orNone
if the validation failed
-
on_xbrl_finished
(job, instance)¶ This function is called after the command
valxbrl
(xbrl) has finished validating the XBRL instance document. The arguments arejob of type
xbrl.Job
instance of type
xbrl.Instance
orNone
if the validation failed
-
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 arejob of type
xbrl.Job
document-set of type list containing
xml.Instance
objects that represent the XML Infoset of the Inline XBRL Document Set documentstarget-documents of type dict containing
xml.Instance
objects indexed by the target property orNone
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.