Unwanted line breaks

Questions about XML that are not covered by the other forums should go here.
janaostyn
Posts: 1

Unwanted line breaks

Thu Apr 10, 2014 3:02 pm

Hi,

When I look at my topics in Text mode, it seems like oXygen added unnecessary line breaks to the text:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="reference_ngc_m43_2n" xml:lang="en-gb">
    <title>Grilling under the Dome</title>
    <refbody>
        <section><note type="restriction" id="note_jtb_cbz_ym" product="black">This information only
            applies to models <keyword>Optima</keyword> and <keyword>Major</keyword>. Models
            <keyword>Basic</keyword> and <keyword>Arena</keyword> cannot be equipped with a
            <keyword>Dome</keyword>. </note><note type="restriction" product="color inox">This
            information only applies to models <keyword>Optima</keyword> and
            <keyword>Major</keyword>. Model <keyword>Arena</keyword> cannot be equipped with a
            <keyword>Dome</keyword>. </note>To use your appliance to its full potential, you can
            equip it with a <keyword>Dome</keyword>. The <keyword>Dome</keyword> is a half-open,
            shell-shaped lid that reflects the heat of the charcoal back onto the food. As a result,
            your food is heated from the bottom and from the top. This allows you, amongst others,
            to evenly cook large pieces of meat, to prepare beer canned chickens and even to grill
            pizzas.<note>Use <keyword>Dome</keyword> 223.0043.000 for model
            <keyword>Optima</keyword> and <keyword>Dome</keyword> 223.0050.000 for model
            <keyword>Major</keyword>. For more information on the <keyword>Dome</keyword>, refer to
            <xref href="http://www.barbecookexperience.com" format="html" scope="external"
            >www.barbecook.com</xref>.</note></section>
    </refbody>
</reference>


These line breaks cause trouble during translation. Is it possible to remove them?

Thx,

Jana
Radu
Posts: 5563

Re: Unwanted line breaks

Thu Apr 10, 2014 4:38 pm

Hi Jana,

By default when saving XML documents in the Author visual editing mode Oxygen will add new lines in changed XML elements and break the lines of text after a certain number of characters.
This is covered in more detail here:

http://www.oxygenxml.com/doc/ug-oxygen/#topics/author-whitespace-handling.html

The obtained XML is equivalent with the original XML because the normalized text is still the same. So I consider this as a bug in the translation software.

Anyway, if you want to inhibit this default behavior you can go to the Oxygen Preferences->Editor / Format page you can check the "Use zero-indent" checkbox + increase the "Line width" value from "100" to a very high number. This will avoid breaking the text lines.

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

Re: Unwanted line breaks

Thu Mar 26, 2015 7:45 am

Hello,

Is there a maximum value for this setting?
I've tried well past the maximum pre-set value of 1000 and it just seems to keep going.

Cheers,

Eddie
Radu
Posts: 5563

Re: Unwanted line breaks

Thu Mar 26, 2015 9:32 am

Hi Eddie,

The maximum value for the line width is the maximum integer value possible on the platform, usually something like in the order of two billion characters per line 2147483647.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Patrik
Posts: 228
Location: Hamburg/Germany

Re: Unwanted line breaks

Thu Mar 26, 2015 2:29 pm

An alternative would be to add the xml:space attribute with fixed or default value 'preserve' to the schema on the note-element.

For my own document type derived from dita I did this for any element that can contain text content - which are quite a lot. (But I wrote my own xml schema anyway, so it was very easy.)

However, when using the standard dita schema you should really consider an adaption of the transformation - as Radu already mentioned. You'd simply need to use the function normalize-space before interpreting the text content.

Regards,
Patrik
Radu
Posts: 5563

Re: Unwanted line breaks

Thu Mar 26, 2015 2:58 pm

Hi Patrik,

There seems to be two major use cases when it comes to space-preserving content after it is edited in the Author mode:

1) Some want to have space preserve at block level. So they still want line breaks between paragraphs but they want the actual paragraph content to appear on one line. So they would use a very large line width format setting. Usually they also want zero indent.

2) Others want the entire document on one line. This would mean setting the root element as space preserve either from the CSS, list of space preserve elements or by setting xml:space on the root element.

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest