Whitespace handling changes in 11.1

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
honyk
Posts: 168
Joined: Wed Apr 29, 2009 4:55 pm

Whitespace handling changes in 11.1

Post by honyk » Thu Mar 11, 2010 4:46 pm

Hello,

I've just discovered weird behaviour of the white space handling, which differs from version 11.0.
While in 11.0 all images (DocBook document) are inline according to the specificication in the CSS file:

Code: Select all

<inlinemediaobject><imageobject><imagedata
fileref="Icons/IconSave.gif"/></imageobject></inlinemediaobject>
in version 11.1 it is saved the following way:

Code: Select all

<inlinemediaobject>
<imageobject>
<imagedata fileref="Icons/IconSave.gif"/>
</imageobject>
</inlinemediaobject>
To tell the truth, we use the same docbook4.framework file from 11.0 version and I've found there are small changes relative to all lists where xml:space preserve is 'Inside as first child' instead of 'Inside', but there is nothing connected to images.

I need to ensure original behaviour as now there are unintended spaces between text and inline images. Is there any workaround or fix for this? Is it necessary to change something?

Regards,
Jan

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

Re: Whitespace handling changes in 11.1

Post by Radu » Thu Mar 11, 2010 4:58 pm

Hi Jan,

Oxygen 11.1 also looks at the associated DTD information (which is considered more important than the CSS display) to determine whether an XML tag is element only (and it can be indented as a block) or with mixed content (and whitespaces cannot be added in order to indent it).
For example, the Docbook DTD says that inlinemediaobject is element only so the Oxygen format and indenter can format it by adding indent and line breaks. The XML should equivalent in both cases but if you want the old behavior you can go to the Oxygen Preferences Editor / Pages / Author / Schema aware page and uncheck the Schema aware normalization.... checkbox.

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

honyk
Posts: 168
Joined: Wed Apr 29, 2009 4:55 pm

Re: Whitespace handling changes in 11.1

Post by honyk » Thu Mar 11, 2010 6:15 pm

Thanks for the info, it helped. I am just curious what is the difference between this option and Editor|Format|XML|Schema aware format and indent option. I see the risk these two can interfere.

Jan

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

Re: Whitespace handling changes in 11.1

Post by Radu » Thu Mar 11, 2010 6:29 pm

Hi,

The option you are referring to refers to the format and indent which happens in the Text page (by clicking the "Format and indent" toolbar action for example).
We have a separate checkbox for the Author because the Author looks in the CSS for some situations when schema-aware is enabled and thus has a subordinate checkbox: Indent blocks-only content.
So the two schema aware checkboxes apply to different pages.

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

honyk
Posts: 168
Joined: Wed Apr 29, 2009 4:55 pm

Re: Whitespace handling changes in 11.1

Post by honyk » Thu Mar 11, 2010 7:06 pm

This sub option is still not very clear to me (maybe some use case could help), but if all this stuff if unchecked, I am still getting slight differences:
Instead of

Code: Select all

<entry colname="col3"> </entry>
I get:

Code: Select all

<entry colname="col3">
</entry>
Or instead of

Code: Select all

<para>Check the appropriate installer files in the <guilabel
>...
this

Code: Select all

 <para>Check the appropriate installer files in the
<guilabel>...
(There is stilll enough place to keep starting element on the same line)

Any idea? It it important for us for version control...
Jan

honyk
Posts: 168
Joined: Wed Apr 29, 2009 4:55 pm

Re: Whitespace handling changes in 11.1

Post by honyk » Fri Mar 12, 2010 10:22 am

To tell the truth, I don't insist on old behaviour. If the current one is the standard for the future, it is Ok. I'd like just avoid another code reformatting in any future version...

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

Re: Whitespace handling changes in 11.1

Post by Radu » Fri Mar 12, 2010 11:14 am

Hi Jan,

We made changes so that format and indent when saving in the Author would be equivalent to format and indent in the Text mode.
For example the author had a tendency to break line between an element's tag start <guilabel and the > even if the element had no attributes, thing which did not happen in the Text mode.
I cannot reproduce the <entry> </entry> being split on multiple lines.

What Oxygen 11.2 will bring in addition to this will be that it will only format and indent the modified elements. So it will be far better for working with version control as XML modifications will be limited to the edited elements.

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

honyk
Posts: 168
Joined: Wed Apr 29, 2009 4:55 pm

Re: Whitespace handling changes in 11.1

Post by honyk » Fri Mar 12, 2010 4:10 pm

> What Oxygen 11.2 will bring in addition to this will be that it will only format and indent the modified elements.

This sounds really great!

(But I hope there will still be a chance to invoke reformatting for special cases manually)

After some consideration I tend to keep the default Oxygen settings. Our changes via css were almost workarounds and it is not necessary anymore.

There is the only css driven change of a default DocBook DTD behaviour when one combination of elements produces 'preserve-space' code. This, a bit surprisingly after all previously mentioned, works also if 'Schema aware formatting' is checked. I am just currious if this will be 'fixed' (and we will have to choose another approach (XSLT way) to get the intended output).

Regards,
Jan

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

Re: Whitespace handling changes in 11.1

Post by Radu » Mon Mar 15, 2010 9:42 am

Hi Jan,

I should have been more precise.

The "Schema aware format and indent..." does not mean that only the associated schema is taken into account.

In the case of space preserve the following information is used in the following order:
1) If the XML <tag> contains an xml:space attribute or is the descendant of one.
2) If it is in a CSS white-space context.
3) If in the Oxygen Editor/Format/XML preferences page the element is in one if the space-preserve lists
4) If the associated schema specifies a default xml:space attribute for an element.

The same sources are used to consider an element mixed or element-only.

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

Post Reply