RacerNerd
RacerNerd

Reputation: 1577

Add Quotes to HTML Attributes

I have been given an HTML document that was originally produced using Word. The HTML produced could use some cleaning up and is pretty long so doing it by hand will be tedious. I will also need to do this with other HTML documents from this same source in the future so having an easy solution will be helpful beyond this single instance.

One of the problems is unquoted HTML attributes. I would like to avoid adding all of the quotes by hand and am looking for a simple way to do this.

Here is a screen shot showing a snippet of the file: enter image description here

The screen shot is from Visual Studio 2010. Visual Studio recognizes that there is a validation error and recommends adding the quotes but I can't find a tool to automatically add the quotes. Is there an option in Visual Studio that will take care of adding the quotes?

I originally came to ask the question specifically about doing this in Visual Studio but I am really just looking for a good solution. I am not stuck in Visual Studio so if there are any other recommendations they will be appreciated.

Upvotes: 0

Views: 219

Answers (2)

Yuriy Petrovskiy
Yuriy Petrovskiy

Reputation: 8188

I've done this with HTMLTrim software. The only point I had to correct is to remove <o:p></o:p> tags from all document using text editor, as it complained on them. It do not replaces single quotes to double ones, but I've done it with the same text editor. If you need to open this document in word afterwards - you will need to remove <?xml ...?> header.

Upvotes: 1

Santosh Panda
Santosh Panda

Reputation: 7341

Have a look into this tidyfornet which is a .Net wrapper of HTML Tidy, a Java package which generates valid HTML/XHTML from tag soup.

Upvotes: 1

Related Questions