Unwanted reformatting

Having trouble installing Oxygen? Got a bug to report? Post it all here.
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Unwanted reformatting

Post by sijomon »

Hello Again,

Phase 1 of our project has now been released. Thanks so much for all your assistace so far.

I am now dealing with the first round of bug reports - oh joy ;)

One bug relates to inserting XML fragments. We have an operation that grabs XML fragments from a third party tool and then inserts them into the current Oxygen document. The problems is that Oxygen seems to reformat not only the XML fragment, but the entire document, as part of the insert.

The desired behaviour is to insert the XML fragment as receieved form the third party tool without reformatting it, specifically without inserting ANY line breaks or other whitespace, and deffinately without reformatting the rest of the document.

Is there some option I'm missing, either in the Oxygen preferences or in the API?

Thnaks,

Simon.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Unwanted reformatting

Post by sorin_ristache »

Hello,

For the inserted XML fragment Author mode should apply the CSS properties that are specified in the CSS stylesheet for the inserted elements. The formatting of the elements that were in the document should not change. Please specify an example for reproducing the problem.


Regards,
Sorin
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Unwanted reformatting

Post by sijomon »

To clarify, its not the view in the Author mode which is updated, it is the actual XML document as viewable in Text mode. Prior to the insert there is no formatting (no tag indenting, no maximum line lengths etc) after the insert there is formatting (tags are indented, long lines are wrapped etc).
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Unwanted reformatting

Post by sorin_ristache »

For inserting an XML fragment in Text mode using copy and paste you specify that you do not want to indent/reformat the pasted XML fragment by disabling the option Indent on paste that is available from menu Options -> Preferences -> Editor -> Format -> XML.

If you insert the XML fragment in Author mode with a custom Author action and the reformatting is applied when you switch from Author mode to Text mode but you want no formatting in Text mode after the switch then you should know that this is possible for any XML document and any inserted XML fragment only if you add the attribute xml:space="preserve" to the inserted XML fragment (if you want to preserve that fragment) or to the root of the document (if you want to preserve the whole document). Otherwise it is not possible in all cases to preserve the whitespace characters by a switch from Text mode to Author mode and back to Text mode. The cause is that the XML document is normalized when switching to Author mode which means the initial number of whitespace characters that preceded the switch to Author mode is not remembered/rendered in Author. That forces a line break between two adjacent CSS blocks when switching to Text mode regardless of the initial whitespace characters that separated the two blocks before the switch to Author mode.


Regards,
Sorin
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Unwanted reformatting

Post by sijomon »

That's got it, thanks.
Post Reply