Using an entity for block of XML destroys my pretty printing layout

Questions about XML that are not covered by the other forums should go here.
menkalos
Posts: 14
Joined: Wed May 13, 2015 11:59 pm

Using an entity for block of XML destroys my pretty printing layout

Post by menkalos » Tue Nov 17, 2020 9:37 pm

I know you can use an entity to represent both inline text and an entire block of XML tags.

When I use an entity to represent a large block of XML, and the do the CTRL-SHIFT-P to "pretty print" the XML, the entity is treated as an "inline" thing and (even if what comes before it and after it are their own blocks) gets the white space before and after it removed. This makes it very hard to read by burying what could be a very important element in the middle of a line and messing up the formatting of what came before and after as well.

I'd love to know of a way to address this, and if there is not yet one, to encourage the devs to address this somehow.

Thanks much!!!

Radu
Posts: 7528
Joined: Fri Jul 09, 2004 5:18 pm

Re: Using an entity for block of XML destroys my pretty printing layout

Post by Radu » Wed Nov 18, 2020 5:40 pm

Hi,

Thanks for the report, I added an internal issue for it: "EXM-46792 - Treat entity reference in element only content as an element".
If we make any progress on this in a future release I will update this forum post.

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

Mircea
Posts: 91
Joined: Tue Mar 25, 2003 11:21 am

Re: Using an entity for block of XML destroys my pretty printing layout

Post by Mircea » Mon Mar 08, 2021 1:29 pm

Hello,

Thank you for reporting this issue.
The fix was included in the new 23.1 version that was rele4ased few days ago.

Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

menkalos
Posts: 14
Joined: Wed May 13, 2015 11:59 pm

Re: Using an entity for block of XML destroys my pretty printing layout

Post by menkalos » Mon Mar 08, 2021 9:15 pm

No, I don't think it is. I just upgraded to 23.1, and entered this:

Code: Select all

    <documentation target="operation-name$parameter">
         &some-entity; 
    </documentation>
where &some-entity; is an entity with a <para>...</para> as the outermost tags. However, when I press CTRL-SHIFT-P to "pretty print", it still all gets sucked into a single line:

Code: Select all

    <documentation target="operation-name$parameter"> &some-entity; </documentation>
I want my block tag spacing with line breaks to be respected by pretty-print. Stop destroying the white space, please!

If I missed a setting that must be enabled to turn on the "fix", please let me know! Thank you!

Mircea
Posts: 91
Joined: Tue Mar 25, 2003 11:21 am

Re: Using an entity for block of XML destroys my pretty printing layout

Post by Mircea » Wed Mar 10, 2021 11:53 am

Hello,

Thank you for the feedback!

We implemented this suport for elements only content, as specified by the schema of the document. We cannot detect what is the content of the entity when formatting the document.
Having this in mind we decided that putting entities on a different line is acceptable for elements only content.
For mixed content or text only content elements the entity is treated as a regular text.

Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply