[oXygen-user] Important tip when using Oxygen XML

Joel Kalvesmaki director at textalign.net
Fri May 13 13:55:56 CDT 2022


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

-- 
Joel Kalvesmaki
Director, Text Alignment Network
http://textalign.net


More information about the oXygen-user mailing list