How to replace the text content of an element

<oXygen/> general issues.
Seb
Posts: 23
Joined: Mon Feb 20, 2017 8:03 pm

How to replace the text content of an element

Post by Seb » Wed Jul 17, 2019 12:50 pm

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.

mihaela
Posts: 203
Joined: Wed May 20, 2009 2:40 pm

Re: How to replace the text content of an element

Post by mihaela » Thu Jul 18, 2019 11:14 am

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
Mihaela Calotescu
http://www.oxygenxml.com

Seb
Posts: 23
Joined: Mon Feb 20, 2017 8:03 pm

Re: How to replace the text content of an element

Post by Seb » Fri Jul 19, 2019 12:19 pm

Thanks for the reply.

Do you know, when Oxygen 22 will be released?

mihaela
Posts: 203
Joined: Wed May 20, 2009 2:40 pm

Re: How to replace the text content of an element

Post by mihaela » Mon Jul 22, 2019 10:20 am

Hi,

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

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com

Post Reply