How can I define a JSON file so that a custom node can be used as an attribute in an extension element

this userTask element has extensionElement

<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:custom="http://activiti.com/modeler" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
    <process id="LXP2020101401" name="LXP2020101401" isExecutable="true">
        <userTask id="sid-D90F4406-A16F-41CC-A6A3-68226880FAB3" name="apply" activiti:assignee="jsm1003">
        <extensionElements>
      <custom:test><![CDATA[sid-68CD96BC-0601-49D1-BCD6-033B4814D5B1,sid-A70D1BD6-353F-414E-9136-9CABF447AD9B,sid-35A1D9FB-1B01-4381-BE36-3724EFCF6E0E]]></custom:test>
    </extensionElements>
        </userTask>
    </process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_LXP2020101401">
        <bpmndi:BPMNPlane bpmnElement="LXP2020101401" id="BPMNPlane_LXP2020101401">
            <bpmndi:BPMNShape bpmnElement="sid-D90F4406-A16F-41CC-A6A3-68226880FAB3" id="BPMNShape_sid-D90F4406-A16F-41CC-A6A3-68226880FAB3">
                <omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"/>
            </bpmndi:BPMNShape>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</definitions>

and I want to use custom xml file, I hope that the function of “custom:draft” is the same as that of the “extensionElements” node. How should I define the JSON file or how I can get the information of this node

<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:custom="http://activiti.com/modeler" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
    <process id="LXP2020101401" name="LXP2020101401" isExecutable="true">
        <userTask id="sid-D90F4406-A16F-41CC-A6A3-68226880FAB3" name="apply" activiti:assignee="jsm1003">
        </userTask>
    </process>
     <bpmndi:BPMNDiagram id="BPMNDiagram_LXP2020101401">
        <bpmndi:BPMNPlane bpmnElement="LXP2020101401" id="BPMNPlane_LXP2020101401">
            <bpmndi:BPMNShape bpmnElement="sid-D90F4406-A16F-41CC-A6A3-68226880FAB3" id="BPMNShape_sid-D90F4406-A16F-41CC-A6A3-68226880FAB3">
                <omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"/>
            </bpmndi:BPMNShape>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
    <custom:draft ref="sid-D90F4406-A16F-41CC-A6A3-68226880FAB3" test="233">
      <custom:test><![CDATA[sid-68CD96BC-0601-49D1-BCD6-033B4814D5B1,sid-A70D1BD6-353F-414E-9136-9CABF447AD9B,sid-35A1D9FB-1B01-4381-BE36-3724EFCF6E0E]]></custom:test>
    </custom:draft>
</definitions>

this is my JSON config file:

{
  "name": "customBpm",
  "uri": "http://example.com",
  "prefix": "custom",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "types": [
    {
      "name": "draft",
      "properties": [
        {
          "name": "ref",
          "isReference": true,
          "isAttr": true
        },
        {
          "name": "test",
          "isAttr": true
        }
      ]
    }
  ]
}

You can’t add a custom element to definitions like that. extensionElements is the right place to put any custom elements that are extensions.

1 Like

how I can get the information of the custom:draft ?

Are you aware that this is not a valid BPMN diagram?

I know that is a invalid BPMN diagram.

What exactly are you struggling with? Have you seen this example: https://github.com/bpmn-io/bpmn-js-examples/tree/master/custom-meta-model You can create your extension in the exact same way.