Conversion to entity in Author view

Questions about XML that are not covered by the other forums should go here.
Kentt
Posts: 2

Conversion to entity in Author view

Sun Nov 10, 2013 4:32 pm

Hello,

If I type in the "less than" and "greater than" characters in the Author view, only the "less than" character is converted automatically to an entity. Is there a way to change this behavior and make both characters get converted automatically? Thanks.
Radu
Posts: 5866

Re: Conversion to entity in Author view

Mon Nov 11, 2013 12:55 pm

Hi,

Could you elaborate on your use case?

The ">" character is not an illegal character in XML content (only the "<" is). So as it is not necessary to convert it to the character entity equivalent, Oxygen does not do this.

If you want instead of ">" you could insert directly the entity equivalent from the Oxygen "Entities" view but this needs to be done manually. Or you could use our Java-based API to intercept the ">" key typed and insert the entity reference &gt; instead of the character.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Eddie
Posts: 97

Re: Conversion to entity in Author view

Tue Aug 12, 2014 10:23 am

Hello,

Slightly different to the original post.

This isn't really important but I also noticed that the less than sign is shown as just "<" in Author view, but the greater than sign is shown as ">" in dummy "gt" tags.
Is it to save space in Author view (by not enclosing "<" in dummy tags)?
I usually work in Text view so it's not really a problem, but it seems quite incongruous when you switch to Author view.
Radu
Posts: 5866

Re: Conversion to entity in Author view

Tue Aug 12, 2014 10:49 am

Hi Eddie,

In the saved XML content the < character always needs to be escaped to &lt;, otherwise it breaks the XML validation. So in the Author page we just present it as a simple < character in the text content and let the user insert it as a simple character for convenience. When the XML is saved the Author page converts < to &lt; automatically.

The > character in text content actually does not break the XML validation. So for example if you are editing in the Text mode it is not necessary for you to convert it to &gt;, you can leave it exactly like it is:>. Most people escape it as well but it is not necessary to do so, only less-than needs to be escaped.

When switching to the Author editing mode if the greater than was encoded as a simple character, it is kept as such, if it was encoded as the greater-than entity reference it is kept as an entity reference. In this way, when the XML is saved, Oxygen will know to encode greater-than exactly as it was encoded.

Ideally when working in the Text page you would only encode < as &lt;, in this way in the Author visual editing mode both less-than and greater-than would appear as simple characters.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Eddie
Posts: 97

Re: Conversion to entity in Author view

Wed Aug 13, 2014 2:53 am

Understood.

Thanks for the reply.

Ed.

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests