spacing issue

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

spacing issue

Post by shikhar_472 »

Hi Team,

Is there any way to prevent not to add more than one space before, after and in between the words.

Thanks,
Shikhar.
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: spacing issue

Post by cristi_talau »

Hello,

In XML, whitespaces between two words are usually "normalized" to just one space. The reason being that tools usually choose to indent text inside paragraphs by adding spaces and newlines. This normalization happens in Web Author when the editor is opened, so during editing you may be able to see multiple consecutive spaces, but when you reload the editor they will become only one.
A reason for allowing consecutive whitespaces temporarily is that during editing people enter two spaces and then insert a word between them.
If you are using some legacy tools that do not normalize whitespace you can use an AuthorDocumentFilter to block users from inserting consecutive whitespaces.

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: spacing issue

Post by shikhar_472 »

which method we can override to prevent this inside AuthorDocumentFilterBypass
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: spacing issue

Post by Bogdan Dumitru »

Hello Shikhar,

First, identify all methods that filter text nodes (exclude attributes-specific methods like "setAttribute", exclude doctype-specific methods, etc.).
Then you can either override all of them or decide for each method if it fits your use-case or not (you may opt to normalize spaces only when typing or also when pasting content).
Bogdan Dumitru
http://www.oxygenxml.com
jeankaplansky
Posts: 21
Joined: Tue Jun 08, 2021 8:22 pm

Re: spacing issue

Post by jeankaplansky »

Related to authoring whitespace:

We recently migrated from an HTML5 authoring tool to XHTML5 in OWA and are encountering a whitespace issue specific to markup. We are trying to clean up and normalize whitespace on the migrated files in the repository.

Users then check out the files for OWA edits—they add and remove markup and text content. When users edit content in OWA, we can immediately see the whitespace introduced by inserting markup in the "Edit as XML" view. Our users are discouraged from working in the "Edit as XML" view, but compliance will forever be an issue if we continue to make the "Edit as XML" view available to users.

You mention that OWA shows the whitespace in the UI until you save the file, which reverts to considering whitespace normalized behind the scenes. Our experience, however, is that whitespace persists wherever a user inserts markup in OWA - especially in tables, lists, and other block elements.

Our downstream processes are _not_ in the XML ecosystem, and ingestion into our non-XML ecosystem processes is tripping over the whitespace that persists around block-level markup inserted in OWA. Once saved in the "Edit as XML View," whitespace persists in the XHTML5 and is _not_ ignored. We currently do not have a "Normalized XML" button or anything the end users can do to get rid of whitespace after they edit content in OWA.

How might we use `AuthorDocumentFilterBypass` to normalize the whitespace introduced in OWA by inserting block element markup and tables? Or is there another best practice approach we should take? I'm open to consider disabling the "Edit as XML" option if that's possible.

This is a significant pain point for our content delivery efficiency.

Thanks for your input.
Jean Kaplansky
Jean Kaplansky
Kaplan North America
jean.kaplansky at kaplan dot com
cosminef
Site Admin
Posts: 84
Joined: Wed Aug 30, 2023 2:33 pm

Re: spacing issue

Post by cosminef »

Hello,

Thank you for contacting us.
Could you please confirm if you can replicate this situation on an out-of-the-box Web Author kit? [1]

[1] https://www.oxygenxml.com/xml_web_autho ... tml?os=All

Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
jeankaplansky
Posts: 21
Joined: Tue Jun 08, 2021 8:22 pm

Re: spacing issue

Post by jeankaplansky »

Hi, Cosmi -
The Edit as XML view of the demo OWA documents shows me XHTML that isn't normalized:
image.png
image.png (188.09 KiB) Viewed 295 times
I can try adding content to it in the Author view:
image.png
image.png (125.51 KiB) Viewed 295 times
But I get the expected not normalized line breaks. Please see the attachment.
I have to normalize the file to remove all extraneous ASCII formatting/space to process this file in our downstream, non-xml systems. We process our XHTML files frequently so we can preview the content in the downstream platform. The lack of normalization in OWA is a serious issue for us. We will need to post-process prior to sending the files to the downstream platform if OWA cannot preserve the normalization we apply in Oxygen XML Editor desktop.

Please advise.

Thanks!
test.xhml.zip
(2.46 KiB) Downloaded 10 times
Jean Kaplansky
Kaplan North America
jean.kaplansky at kaplan dot com
cosminef
Site Admin
Posts: 84
Joined: Wed Aug 30, 2023 2:33 pm

Re: spacing issue

Post by cosminef »

Hello,

Thank you for your reply!
To ensure that we fully understand your use case, could you show us with examples how a normalized document should look like in your case?
We will need to post-process prior to sending the files to the downstream platform if OWA cannot preserve the normalization we apply in Oxygen XML Editor desktop.
Do you have any specific formatting settings applied in the Oxygen XML Editor desktop? If yes, it would be helpful if you could highlight them for us.

Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
jeankaplansky
Posts: 21
Joined: Tue Jun 08, 2021 8:22 pm

Re: spacing issue

Post by jeankaplansky »

Our team works primarily in text mode when we run scripts and other processes on our body of content.

One of the first things we do when we open the file is a Join and Normalize operation (command+J on a macbook) to remove all line breaks. We then do a find and replace /> </></:
image.png
image.png (380.91 KiB) Viewed 239 times
(Ignore the fact that the sample doc in question contains a formatted screen element - we don't do anything requiring space preservation.)

Our end users edit the content in author mode in OWA. Inserting block-level markup is part of their process. They work in author mode. For example, if open the same file I normalized in Oxygen XML Editor desktop in OWA and add a table, I get something that looks like this in author view:
image.png
image.png (49.05 KiB) Viewed 239 times
If the user inserts new content like a table, equation, or multilevel list, we find that OWA immediately formats the underlying ascii with tabs and spaces when they save the file. We see the following If another user looks at the file through the "Edit as XML" menu option:
image.png
image.png (276.05 KiB) Viewed 239 times
Inserting the table added a bunch of new line breaks and indents in the ASCII file that we do not want because our non-XML downstream processes do not know what to do with whitespace in an ASCII file and won't simply ignore it the way downstream XML processes work.

We need something that will join and normalize the file just before it is saved in OWA. There is no way to do this in the OWA UI, and I don't see a configuration option OOTB to prevent the inserted linebreak and indents when we insert new block elements. Is there anyway to control this in OWA at all? Or must we always run a script to join and normalize/delete whitespace between XML elements when we send content to downstream processes?

Please let me know what questions you have about this workflow.

Thanks!
Jean Kaplansky
Kaplan North America
jean.kaplansky at kaplan dot com
cosminef
Site Admin
Posts: 84
Joined: Wed Aug 30, 2023 2:33 pm

Re: spacing issue

Post by cosminef »

Hello,

If you want your modified content to be normalized with no spaces and line breaks, you have to add this entry to options.xml [1] file:

Code: Select all

<entry>
<String>author.format.compatibility</String>
<Integer>1</Integer>
</entry>
After saving the changes made, you have to restart Web Author. [2]

[1] https://www.oxygenxml.com/doc/versions/ ... tions.html
[2] https://www.oxygenxml.com/doc/versions/ ... start.html

Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
jeankaplansky
Posts: 21
Joined: Tue Jun 08, 2021 8:22 pm

Re: spacing issue

Post by jeankaplansky »

Exactly what we need!

Thank you!
Jean Kaplansky
Kaplan North America
jean.kaplansky at kaplan dot com
Post Reply