Model API Output compatible with Modeler

Hi there,

I am trying to create a model using the API (NOT the newer fluent) and I came across a problem.
When following this User Guide | camunda BPM docs what I am doing as a last step, instead of exporting to a file, is Bpmn.convertToString(modelInstance); and the output is the following (expected one I guess):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions id="definitions_a306304c-e2b6-418c-8fbb-e9f529e0b4b5" targetNamespace="https://camunda.org/examples" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
  <process id="process_8648a8b5-7581-43f6-bf33-cf207ba9813a">
    <startEvent id="start">
      <outgoing>flow1</outgoing>
    </startEvent>
    <userTask id="task" name="User Task">
      <incoming>flow1</incoming>
      <outgoing>flow2</outgoing>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="start" targetRef="task"/>
    <endEvent id="end">
      <incoming>flow2</incoming>
    </endEvent>
    <sequenceFlow id="flow2" sourceRef="task" targetRef="end"/>
  </process>
</definitions>

Then, I am trying to open it with the Camunda Modeler and it is not possible. My understanding is that Modeler expects the BPMN standard format.

Hence my question: is there any way to programmatically (via API) export the definition showed above to the format Modeler expects?

Thanks

For anyone interested in it or having the same issue, basically Modeler needs the BPMNDiagram as a part of the definitions, which means that does not infer it, when not present, based on the actual Process.
What I ended up doing is adding BpmnDiagram and BpmnPlane accordingly.