Altova RaptorXML+XBRL Server 2024

The RaptorXML Python API enables data in  XML documents, XML Schema documents, XBRL instance documents, and XBRL taxonomy documents to be accessed and manipulated in Python scripts. Some typical use cases of the Python API include:

 

implement custom validation rules and error messages

export content from XML and XBRL documents to a database

export content from XML and XBRL documents to custom data formats

interactively navigate and query the data model of XML and XBRL documents within a Python shell or Jupyter notebook (http://jupyter.org/)

 

The Python APIs

The Python APIs (for  XML, XSD and XBRL) provide access to the meta-information, structural information, and data contained in XML, XSD, and XBRL instance and taxonomy documents. As a result, Python scripts can be created that make use of the APIs to access and process document information. For example, a Python script can be passed to RaptorXML+XBRL Server that writes data from an XML or XBRL instance document to a database or to a CSV file.

 

Example scripts for Raptor's Python APIs are available at: https://github.com/altova

 

The Python APIs are described in their API references:

 

Python API v1 Reference

Python API v2 Reference

 

Note:Raptor's Python API v1 is deprecated. Please use Python API v2.

 

RaptorXML+XBRL Server package for Python

In your installation of RaptorXML+XBRL Server, you will also find a Python package in wheel format. You can use Python's pip command to install this package as a module of your Python installation. After the RaptorXMLXBRL module has been installed, you can use the module's functions within your code. In this way, RaptorXMLXBRL's functionality can be used easily in any Python program you write, together with other third-party Python libraries, such as graphics libraries.

 

For information about how to use RaptorXML+XBRL Server's Python package, see the section RaptorXML+XBRL Server as a Python Package.

 

Note:The Python wheel in v2024r2 and later is compatible with Python version 3.11.8 and higher.

 

Python scripts

A user-created Python script is submitted with the --script parameter of a number of commands, including the following:

 

valxml-withxsd (xsi)

valxsd (xsd)

valxbrltaxonomy (dts)

valxbrl (xbrl)

 

These commands invoking Python scripts can be used both on the Command Line Interface (CLI) and via the HTTP Interface. The usage of Python scripts with the Python APIs of RaptorXML+XBRL Server are described at: https://github.com/altova.

 

Making Python scripts safe

When a Python script is specified in a command via HTTP to RaptorXML+XBRL Server, the script will only work if it is located in the trusted directory. The script is executed from the trusted directory. Specifying a Python script from any other directory will result in an error. The trusted directory is specified in the server.script-root-dir setting of the server configuration file, and a trusted directory must be specified if you wish to use Python scripts. Make sure that all Python scripts to be used are saved in this directory.

 

Though all output generated by the server for HTTP job requests is written to the job output directory (which is a sub-directory of the output-root-directory), this limitation does not apply to Python scripts, which can write to any location. The server administrator must review the Python scripts in the trusted directory for potential vulnerability issues.

 

© 2018-2024 Altova GmbH