I have tried to use XPath with XML files and it works fine. Now I want to use it with BPMN files. My BPMN file looks sth like this:
<bpmn2:startEvent id="StartEvent_1" name="StartProcess">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
I try to get the value of the id attribute of the bpmn2:startEvent node using this line of code:
startEventID = xml.getParameterString("(//bpmn2:startEvent/@id)");
System.out.println(startEventID);
But it prints me a blank line ... and not the id : StartEvent_1
Any suggestion for this plz?
You can use this expression: "//*[local-name()='startEvent']/@id"
.
Note that this may be tricky if you have same tag names in different namespaces.