[oXygen-user] Important tip when using Oxygen XML

Oxygen XML Editor Support (Radu Coravu) support at oxygenxml.com
Sun May 15 22:48:45 CDT 2022


Hi, Roger, Joel,

One more thing in addition to this, the xml:space attribute does not 
need to be specified directly in the XML, it can be defined as an 
attribute with a default value in the associated schema/DTD.

For example a codeblock defined in the DITA DTD:

> <!ENTITY % codeblock.attributes
>               "%display-atts;
>                spectitle
>                           CDATA
>                                     #IMPLIED
>                xml:space
>                           (preserve)
>                                     #FIXED
>                                     'preserve'
More about this in the user's guide:

https://www.oxygenxml.com/doc/versions/24.1/ug-editor/topics/format-and-indent-xml.html#format-and-indent-xml__dlentry_jgw_bgk_54b

Regards,

Radu

Radu Coravu
Oxygen XML Editor

On 5/13/22 21:55, Joel Kalvesmaki wrote:
> Hi Roger,
>
> For such elements, try adding @xml:space="preserve". Oxygen will 
> preserve those elements, and anyone you share your files with will 
> understand that the space is meaningful.
>
> Best wishes,
>
> jk
>
> On 2022-05-13 08:13, Roger L Costello wrote:
>> Hi Folks,
>>
>> I love the "Format and Indent" button in Oxygen.
>>
>> But it has a gotcha!
>>
>> It replaces multiple spaces in your data with a single space. For
>> example, in my XML document it changed this:
>>
>> <TRM_IDENT>GBE6   BELGRANO 6</TRM_IDENT>
>>
>> to this:
>>
>> <TRM_IDENT>GBE6 BELGRANO 6</TRM_IDENT>
>>
>> See the change in the data?
>>
>> GBE6   BELGRANO 6
>> GBE6 BELGRANO 6
>>
>> Now you might think, "Well, what's the big deal? Why does it matter
>> that Oxygen discarded a few spaces?"
>>
>> Actually, it is a huge deal!
>>
>> In my use case, I have a program which checks that the TRM_IDENT value
>> matches every TRM_IDENT value in another XML file that had not been
>> formatted by Oxygen. My program kept returning an error saying that
>> the values don't match. It took me many hours to find the problem:
>> Oxygen changed the data in the first file.
>>
>> I did some research and found that Oxygen has a way to specify that
>> space is to be preserved during a format and indent operation:
>> Preferences/Editor/Format/XML click on "Preserve text as it is".
>>
>> If you're using Oxygen, I recommend that you open it up right now and
>> click on that option. If you don't, then one day you might run into
>> the same situation and waste many hours trying to figure out why
>> things aren't working.
>>
>> /Roger
>> _______________________________________________
>> oXygen-user mailing list
>> oXygen-user at oxygenxml.com
>> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
>


More information about the oXygen-user mailing list