
Hey, I'm currently working on a WorkspaceAccess plugin and looking for the best way to create a new XML editor from scratch, insert arbitrary XML and then format and indent it following the rules of the loaded document type definitions. This is what I have – and it works: URL newEditorUrl = pluginWorkspaceAccess.createNewEditor("xml", "text/xml", myXmlContentAsUnformattedString); WSEditor newEditor = pluginWorkspaceAccess.getEditorAccess(newEditorUrl, PluginWorkspace.MAIN_EDITING_AREA); WSEditorPage newEditorPage = newEditor.getCurrentPage(); if(newEditorPage instanceof WSXMLTextEditorPage) { WSXMLTextEditorPage newXmlEditorPage = (WSXMLTextEditorPage)newEditorPage; // https://www.oxygenxml.com/forum/topic13197.html Object formatAndIndentAction = newXmlEditorPage.getActionsProvider().getTextActions().get("Source/Pretty_print_tooltip"); newXmlEditorPage.getActionsProvider().invokeAction(formatAndIndentAction); } However, the format and indet snippet is from a forum answer from 2016 and seems to be a workaround if I read Radu's answer correctly: https://www.oxygenxml.com/forum/topic13197.html Calling an Action based on it's tooltip name seems to be quite hacky – is this still the recommended solution? I'm also wondering whether creating and opening a new editor the way I did is the right/best way to do it. Any suggestions? Best regards, Tobias -- Tobias Fischer Head of Development Senior Software Engineer (XML/EPUB/PrintCSS) Telefon: +49 (0)7071 9876-44 · Fax: -22 Mail: tobias.fischer@pagina.gmbh pagina GmbH - Publikationstechnologien Herrenberger Straße 51 | D-72070 Tübingen www.pagina.gmbh | www.parsx.de Handelsregister Stuttgart - HRB 380249 Geschäftsführer: Tobias Ott