Page 1 of 1

How to access to the DocumentController from text editor ?

Posted: Mon May 22, 2023 12:41 pm
by Vince
Hello,

I need to access the AuthorDocumentController from WSEditorTextPage.

It's for evaluate an XPath 2.0 expression on current editing document.

Thanks a lot

Vincent

Re: How to access to the DocumentController from text editor ?

Posted: Mon May 22, 2023 2:54 pm
by mihaela
Hello,

If you are referring to Oxygen XML Editor (not Oxygen Web Author), you can use the following API to evaluate an XPATH expression:
ro.sync.exml.workspace.api.editor.page.text.xml.WSXMLTextEditorPage.evaluateXPath(String)

Best Regards,
Mihaela

Re: How to access to the DocumentController from text editor ?

Posted: Mon May 22, 2023 3:35 pm
by Vince
Hi,

Thanks. It works !

But is there any approach that doesn't depend on the selected editing page ?

i.e. I want to evaluate XPath against my current document, whatever I display author page, text page or grid page.

Regards,
Vincent

Re: How to access to the DocumentController from text editor ?

Posted: Mon May 22, 2023 3:43 pm
by Vince
I notice that XPath evaluation dn't give me same results between

ro.sync.exml.workspace.api.editor.page.text.xml.WSXMLTextEditorPage.evaluateXPath(String)

and

ro.sync.ecss.extensions.api.AuthorDocumentController#evaluateXPath(String, boolean, boolean, boolean)


Why this ?

My xpath:

Code: Select all

//*[contains(@class, ' topic/image ')]/@href

Thanks

Re: How to access to the DocumentController from text editor ?

Posted: Tue May 23, 2023 6:17 am
by Radu
Hi,
When an XML document is loaded in Oxygen desktop, it has 3 edit modes Text/Grid/Author. These three modes have totally different internal models so the APIs to access them is totally different. For the Grid mode we provide no API to access and change its internal model, for the Author mode we provide extensive API to access and change its internal model. For the Text mode (which you seem to be interested in) we provide some API to access its contents, run XPath but the Text mode does not have a nodes structure underneath, it's plain XML content placed in a text area so the API is not similar to when working with the Author mode.
Regards,
Radu