Hello!!
After search in google for a lot of time, I'm think that the best option is to ask to you :D
I'm trying to parse a bpmn 2.0 to extract the all extensions elements. But I didn't obtain any result.
Using this two lines of code, I had obtain the all bpmn2.0 xml in String format:
BpmnModelInstance modelInstance = Bpmn.readModelFromStream(fileStream)
String xmlBpmn = Bpmn.convertToString(modelInstance)
But, at this point I don't know how continue. I'm trying:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance()
DocumentBuilder db = dbf.newDocumentBuilder()
ByteArrayInputStream bin = new ByteArrayInputStream(xmlBpmn.getBytes("utf-8"))
InputSource ins = new InputSource(new StringReader(xmlBpmn))
Document doc = db.parse(ins)
And I think that using it, I can obtain the elements from document, but the document has null element root. After this test, I try to parser using the camunda parser:
import org.camunda.bpm.engine.impl.util.xml.Parser
From this parser I find the api documentation, but I don't know how it works. I think that it works the saxParser, but I didn't find any example.
So please, can you help me or give me an example that demonstrate how to implement this parser.
For example if you have this bpmn 2.0, how can obtain the camunda form data, using a parser. Or other element, it's only to see an example.
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:process id="SimpleProcess14" name="SimpleProcess14" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1" name="StartEvent">
<bpmn2:extensionElements>
<camunda:formData>
<camunda:formField id="name" label="Name" type="string"/>
<camunda:formField id="age" label="Age" type="long" defaultValue="30"/>
<camunda:formField id="task" label="Task" type="string" defaultValue="hit toda"/>
</camunda:formData>
</bpmn2:extensionElements>
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="UserTask_1"/>
<bpmn2:endEvent id="EndEvent_1" name="EndEvent">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:userTask id="UserTask_1" name="user_task">
<bpmn2:extensionElements>
<camunda:formData>
<camunda:formField id="age" type="long" defaultValue="30"/>
<camunda:formField id="name" type="string" defaultValue="pepito"/>
<camunda:formField id="marica" type="boolean" defaultValue="True"/>
</camunda:formData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="UserTask_1" targetRef="EndEvent_1"/>
</bpmn2:process>
Thx!!!