How to get the root node information using the container created by'Navigated Viewer'?

Hello, I created the container in the following way. I want to get the information of the root node after rendering the BPMN diagram. What should I do?

import BpmnViewer from ‘bpmn-js/lib/NavigatedViewer’;

viewer.importXML(bpmn,(err)=>{
if (!err) {
// getRootElement
}

viewer.get('canvas').getRootElement() should make this, if by root you mean the root element (bpmn:Process or bpmn:Collaboration). canvas.getContainer() allows to access the container HTML element, but you already have it when you instantiate the Viewer.

1 Like

Thank you very much.this is very useful.