문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top