Page 1 of 1

How to use following kind of tag to add or rename tag

Posted: Thu Sep 08, 2022 4:43 pm
by SmitaPatil
Hi Team,
I want to add tag such as <?Pub Caret 44?> and <?Pub _link?> <?Pub /_link?> in document.
I tried to use surroundInFragment method but its not working.
Just wanted to check if there is any way to tag this kind of tag.

Thanks,
Smita

Re: How to use following kind of tag to add or rename tag

Posted: Fri Sep 09, 2022 9:29 am
by mihaela
Hello,

In general to insert an XML fragment you should use the API:ro.sync.ecss.extensions.api.AuthorDocumentController.insertXMLFragment(String, int).

For example, let's say that you want to insert the first processing instruction at caret offset. This is the sample code:

Code: Select all

String myFragment = "<?Pub Caret 44?>";
authorAccess.getDocumentController().insertXMLFragment(myFragment, authorAccess.getEditorAccess().getCaretOffset());
Please let us know if this is not right for your use case and you need more information.

Best Regards,
Mihaela

Re: How to use following kind of tag to add or rename tag

Posted: Mon Sep 12, 2022 9:36 am
by SmitaPatil
Hi Mihaela,
Thank you.
Can you please tell the method using which we can just remove tag name without removing text inside it or any method using which we can replace tag name by processing instruction.

Thanks,
Smita

Re: How to use following kind of tag to add or rename tag

Posted: Mon Sep 12, 2022 10:15 am
by mihaela
Hi Smita,

There is an API method that you can use to remove the tags of an element: ro.sync.ecss.extensions.commons.operations.CommonsOperationsUtil.unwrapTags(AuthorAccess, AuthorNode).
Then, to add the processing instructions just use the ro.sync.ecss.extensions.api.AuthorDocumentController.insertXMLFragment(String, int) method that I mentioned in my previous message.

Best Regards,
Mihaela

Re: How to use following kind of tag to add or rename tag

Posted: Mon Sep 12, 2022 12:37 pm
by SmitaPatil
Hi Mihaela,
Thank you so much.
Can you please provide documentation link on handling Processing instruction in oxygen xml editor and web author .
it will be helpful.

Thanks,
Smita

Re: How to use following kind of tag to add or rename tag

Posted: Mon Sep 12, 2022 2:24 pm
by mihaela
Hi Smita,

Can you please give us more details about what do you mean by "handling Processing instruction"?

Here are some documentation links:
1. Oxygen XML Editor 24.1 User Guide
https://www.oxygenxml.com/doc/versions/24.1/ug-editor/

2. Oxygen XML Web Author 24.1 User Guide
https://www.oxygenxml.com/doc/versions/ ... webauthor/

3. Oxygen Web Author 24.1 Customization Guide
https://www.oxygenxml.com/doc/versions/ ... -waCustom/

Best Regards,
Mihaela