Oxygen formats content of text elements

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

Oxygen formats content of text elements

Post by xinelo » Thu Sep 23, 2010 12:18 am

I've got an Xliff file that has elements like:

<trans-unit id="283395" resname="CAPI" translate="yes" reformat="yes" xml:space="default" approved="no">
<source xml:lang="en">I would like to start with some general questions.
Can you please tell me in which year you were born?</source>

After I open it in Oxygen it looks like:

<trans-unit id="283395" resname="CAPI" translate="yes" reformat="yes"
xml:space="default" approved="no">
<source xml:lang="en">I would like to start with some general questions. Can you
please tell me in which year you were born?</source>

It's been indented and hard-wrapped (some line breaks have been inserted).

This spoils the internal structure of the text contained in those segments and should be avoided.

I've been trying several options in the Preferences, but to no avail.

Any suggestion?

Thanks a lot, Manuel

xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

Re: Oxygen formats content of text elements

Post by xinelo » Thu Sep 23, 2010 8:53 am

I found the answer myself :)

Preferences | Editor | Format | Format and indent the document on open

However, I still have one doubt. Is it possible somehow to either indent tags but not text contained in one element?

Thanks, xinelo

xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

Re: Oxygen formats content of text elements

Post by xinelo » Thu Sep 23, 2010 8:56 am

I've just realized the format is not clearly kept in my excerpts of code above. I paste them again as code:

My document had:

Code: Select all

      <trans-unit id="283395" resname="CAPI" translate="yes" reformat="yes" xml:space="default" approved="no">
<source xml:lang="en">I would like to start with some general questions.
Can you please tell me in which year you were born?</source>
and oxygen converted it to:

Code: Select all

			<trans-unit id="283395" resname="CAPI" translate="yes" reformat="yes"
xml:space="default" approved="no">
<source xml:lang="en">I would like to start with some general questions. Can you
please tell me in which year you were born?</source>

adrian
Posts: 2699
Joined: Tue May 17, 2005 4:01 pm

Re: Oxygen formats content of text elements

Post by adrian » Thu Sep 23, 2010 10:19 am

Hello,

I see you have xml:space="default" set on the "trans-unit" element. If you want to preserve your indents and line breaks you should change it to xml:space="preserve". Oxygen's Format and Indent feature recognizes this attribute and preserves the whitespaces.

Otherwise, if you can't or don't want to modify the document, you can set for what elements should whitespaces be preserved in the options: Options -> Preferences -> Editor -> Format -> XML. Add a new element to the "Preserve space" list. You may also want to have a look at the other options from that option page, they control various formatting features/restrictions.

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

xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

Re: Oxygen formats content of text elements

Post by xinelo » Fri Oct 22, 2010 2:07 pm

Hi Adrian,

Your answer was great, I learnt a new very important thing. Thanks a lot!

Cheers, Manuel

Post Reply