Remove blank lines in format action

Are you missing a feature? Request its implementation here.
ted.habermann
Posts: 5
Joined: Wed Apr 29, 2009 4:45 pm

Remove blank lines in format action

Post by ted.habermann »

I am dealing with XML that is generated by a program that inserts blank lines in various places in the file. It would be nice if the Format and Indent Command removed these
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Remove blank lines in format action

Post by sorin_ristache »

Hello,

The Format and Indent action removes the blank lines if they are not included in an element that has the atribute xml:space="preserve" and if the option Preserve empty lines is not selected in Preferences -> Editor -> Format -> XML (by default it is selected). Are the blank lines included in an element listed in the Preserve Space Elements list in Preferences -> Editor -> Format -> XML?


Regards,
Sorin
ted.habermann
Posts: 5
Joined: Wed Apr 29, 2009 4:45 pm

Re: Remove blank lines in format action

Post by ted.habermann »

The preferences setting deals with this very nicely... Too many options to keep up with!

Thanks,
Ted
kiai
Posts: 8
Joined: Thu May 15, 2014 10:06 pm

Re: Remove blank lines in format action

Post by kiai »

I'd like to remove blank lines while keeping long lines from breaking. Is there an option for that?
thanks!
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Remove blank lines in format action

Post by adrian »

Hi,

If you just want to remove the blank lines and don't need to format the document, simply use Find > Find/Replace to remove them:
Text to find: \n\s*\n
Replace with: \n
Regular expression enabled
Press Replace All to eliminate all blocks of blank lines.

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