views:

39

answers:

1

I have a lot of old html files that I need to update. Hopefully, not manually.

I can use a find/replace app to go through a directory and find all with <a name= and replace it <span id= since "name" is deprecated. How would I then find all of the correct endtags and convert </a> to </span> without ruining all hyperlinks?

TIA, Linda

edit: I am using a Mac.

A: 

This thread from earlier today may be useful, as it contains a discussion of tools for parsing HTML.

http://stackoverflow.com/questions/3884452/c-crawler-project/3884478#3884478

Here's a specific tool available on MSDN:

http://code.msdn.microsoft.com/SgmlReader

Essentially, there are many options available for manipulating an HTML DOM. These tools would allow you to wrap anchors in spans (if that was the intention), remove unwanted attributes, etc.

EDIT: Per the OP's requirement to use a Mac, ANTLR might get the job done:

http://www.antlr.org/grammar/HTML

Tim
I should have mentioned that I am using a Mac.
Linda