开发者

Visual Studio's Format Document – How to Write it in C#

I'm having a go at writing some C# code which overrides the Render method of the System.Web.UI.Page and then reformats the HTML before presenting it to the browser. This is purely experimental so overhead is not a concern right now.

I'm perhaps a little learned in the ways of the regular expression and would like to utilise them here, but I can't seem to think of a real concise and elegant way of nicely formatting a HTML document. I've managed to completely minify the HTML using regex, but as for correctly indenting it, I'm stumped.

So, if开发者_JAVA百科 you had a string of HTML, using C#, how would you reformat it in much the same way as Visual Studio's Format Document function does? Any ideas would be greatly appreciated.


Use Tidy. I have used this .net wrapper quite successfully.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜