Not to display End tag

Having trouble installing Oxygen? Got a bug to report? Post it all here.
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Not to display End tag

Post by shilpa »

Hi Oxygen Team,
we are using web author plugin and inserting a xml fragment using below code.
String xmlFragment = <embedded.figure.reference rendition-type='online'/>
authorDocumentController.insertXMLFragment(xmlFragment, authorAccess.getEditorAccess().getCaretOffset());
After insertion of xml fragment, in document we can see the below result
<embedded.figure.reference rendition-type='online'></embedded.figure.reference>
but we don't want end tag </embedded.figure.reference> to display in the document.
instead we want to see only <embedded.figure.reference rendition-type='online'/> tag in the web author doucument.

Please help us how to achieve this.
Thank you.
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Not to display End tag

Post by mihaela »

Hello,
When you insert an empty element in the document using the AuthorDocumentController.insertXMLFragment(String, int) API, the tag should be saved in the collapsed form, by default (<embedded.figure.reference rendition-type='online'/> in your case).

Can you please give us more details? Where do you see the empty element expanded (as <embedded.figure.reference rendition-type='online'></embedded.figure.reference>)? In Web Author, in the Author page, or in the Text page (after choosing "Edit as XML")? Or when you open the document in other application?

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Re: Not to display End tag

Post by shilpa »

Hi Mihaela,

Thanks for the reply.
Yes we are seeing in In Web Author.
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Not to display End tag

Post by mihaela »

Hello,

In the Author page of the Web Author both start tag and end tag are presented for all the elements, regardless of their serialization.
What you can do is to use the -oxy-display-tags CSS property to hide both tags of the "embedded.figure.reference" elements.

To associate a CSS with your documents you can create a plugin. We already have a sample plugin that imposes a CSS for rendering all XML documents in our Web Author plugin samples repository.


Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Re: Not to display End tag

Post by shilpa »

Hi Mihaela,

Thank you for the reply.

Actually we don' t want to hide both the gas. Instead we want to hide only end tag.
It should display like below tag in web author.
<embedded.figure.reference rendition-type='online'/>
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Not to display End tag

Post by mihaela »

Hello,

Can you please send us a screenshot with the current display of the element and a picture that explains what you want to obtain, to be sure that we are reffering to the same editor mode?

Thank you,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Re: Not to display End tag

Post by shilpa »

Hi Mihaela,
Please find the below screenshot.
In the below image we don't want to display end tag
image.png
We want something look like below image.
image.png
Regards
Shilpa
You do not have the required permissions to view the files attached to this post.
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Not to display End tag

Post by mihaela »

Hi Shilpa,

Thank you for the screenshots and the explanation.

What you can do is to use the -oxy-display-tags CSS that I mentioned to hide the default tags, and then recreate the start tag rendering on a before pseudo-element of embedded.figure.reference element. Note that you can find the attributes of an element by using the oxy_attributes() CSS function.
You can use the browser inspector to see the styles used for the start tag rendering.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Amrikaa
Posts: 1
Joined: Fri Sep 02, 2022 3:00 pm

Re: Not to display End tag

Post by Amrikaa »

Yes we are seeing in In Web Author.
Post Reply