Page 1 of 1

How to replace the text content of an element

Posted: Wed Jul 17, 2019 12:50 pm
by Seb
I want to replace the text content of an XML element (location defined via XPath) with an oXygen author mode action, but I do not know which operation to choose for this.

The operation InsertOrReplaceText only allows for inserting or replacing text at the caret position.

The operation InsertOrReplaceFragmentOperation with the Xpath element/*[1] and the insertPosition replace does not replace the content either, but does add the text instead.

Re: How to replace the text content of an element

Posted: Thu Jul 18, 2019 11:14 am
by mihaela
Hi,
The commons operations that are available now in the API do not cover your use-case. You can create a custom operation [1] that implements AuthorOperation [2] and replaces the element content.

The good news is that we just implemented an operation that does exactly what you need (called ReplaceElementContentOperation). This will be included in the next release of Oxygen XML Editor (version 22). We can send you a jar containing this operation. For this, please write us an email on our support address: support@oxygenxml.com.

[1] https://www.oxygenxml.com/doc/versions/ ... HowTo.html
[2]https://www.oxygenxml.com/InstData/Edit ... ation.html

Re: How to replace the text content of an element

Posted: Fri Jul 19, 2019 12:19 pm
by Seb
Thanks for the reply.

Do you know, when Oxygen 22 will be released?

Re: How to replace the text content of an element

Posted: Mon Jul 22, 2019 10:20 am
by mihaela
Hi,

The Oxygen 22 release is planned for March, next year.

Best Regards,
Mihaela