FAQs
Q: I want to write a Python script that creates a new XML instance one element at a time while running inside the raptor server. These need to be serialized to the output with different encodings and formatting depending on parameters. Is this possible in RaptorXML+XBRL Server.
A: No, this is currently not possible because we do not have an API for creating arbitrary XML instances. However, when it comes to generating XBRL instances, we do have a high-level API which manages a lot of the technical details (such as avoiding writing duplicate contexts/units, and lots more). See https://www.altova.com/manual/en/raptorapi/pyapiv2/2.9.0/html/xbrl.InstanceDocumentBuilder.html for more information.
Q: I would like to use lxml. Can I install lxml libraries into the Python folder at "RaptorXMLXBRLServer2024/lib/"?
A: You can install most Python modules directly by running the following command in a terminal that has administrator rights:
"/path/to/RaptorXML/application-folder/bin/RaptorXMLXBRL-python.exe" -m pip install lxml
Q: Would it be all right to create a big string that contains the XML instance, then parse the whole thing and re-serialize it.
A: That is one possibility. You can parse and validate XML and XBRL instances from a string buffer using the Python API like this:
from altova_api.v2 import xml
txt = '''<?xml version="1.0" encoding="utf-8"?>
<doc>
<elem attr="foo">bar</elem>
</doc>'''
inst = xml.Instance.create_from_buffer(txt.encode('utf-8')).result
print(inst.serialize())