Conversion to entity in Author view

Questions about XML that are not covered by the other forums should go here.
Kentt
Posts: 2
Joined: Sun Nov 10, 2013 3:38 pm

Conversion to entity in Author view

Post by Kentt »

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: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Conversion to entity in Author view

Post by Radu »

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 > instead of the character.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Eddie
Posts: 106
Joined: Wed Dec 18, 2013 3:07 am

Re: Conversion to entity in Author view

Post by Eddie »

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: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Conversion to entity in Author view

Post by Radu »

Hi Eddie,

In the saved XML content the < character always needs to be escaped to <, 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 < 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 >, 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 <, 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: 106
Joined: Wed Dec 18, 2013 3:07 am

Re: Conversion to entity in Author view

Post by Eddie »

Understood.

Thanks for the reply.

Ed.
Post Reply