Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

UPDATE: I've recently was adviced that I can use VS command Edit/Advanced/Format Document(Ctrl-K,Ctrl-D) and it does better formating.

I 've got XML files as one long string, not formatted. IE explorer shows them nicely with all indentation and ablility to collapse parts.
However to edit or compare files using Windiff or Winmerge it will be convinient to have them with short lines, e.g. each element in a new line.

Fortunately VS has ability to insert new lines in replace operation.
1.Click Ctrl-H
2. Tick "Use Regular Expressions"
3. In Find specify [>]
4. In Replace specify \0\n.
5 Click "Replace All"
After all XML ">" characters a new line will be inserted.

I also used the same approach to insert line breaks into HTML files.

Posted on Monday, January 21, 2008 7:48 PM .Net Framework , Visual Studio/TFS/git | Back to top


Comments on this post: Insert new lines in XML text using Visual Studio.

# re: Insert new lines in XML text using Visual Studio.
Requesting Gravatar...
you can use the <para> tag to mark text as a new paragraph. This puts is on to a new line.
Left by Chris B on Apr 09, 2009 8:07 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net