Capture diagram and export

Hi, how can i capture the xml diagram that is displayed in that moment?
I need to build a function to export it. I check BaseViewer and i find the perfect function to do it, “saveXML” but i don’t understand how can i call it from another page. If i generate a new instance of the viewer it says to me that the dependecies are missing and so, i don’t understand how can i capture the actual istance of the viewer and so, of the built diagram.
Please help

Could you rephrase your request, maybe add a screenshot? I don’t understand what you want to accomplish.

I solved it thank you very much