Generating hyperlinks dynamically (replacing words with links)

J

Jazzdrums

Hello,

I've (parts of ) HTML documents and a list of words that I have to transform
as an hyperlinks, i.e. surround them with a "<a href="...">" "</a>".
A first simple approach is to parse the HTML, loop on each textual nodes and
then loop on each words and made a string replacement provided the fact that
the words isn't in some particular tags context (<title>, etc.).

It could work since my words list is quite small (less than 100 entries),
but it can grow. Do you know if there exists some components that can help
in this task ?
The next step would be to code some letters automata but I have no time for
this.

Thank you
 
A

Arne Janning

Jazzdrums said:
I've (parts of ) HTML documents and a list of words that I have to transform
as an hyperlinks, i.e. surround them with a "<a href="...">" "</a>".
A first simple approach is to parse the HTML, loop on each textual nodes and
then loop on each words and made a string replacement provided the fact that
the words isn't in some particular tags context (<title>, etc.).

It could work since my words list is quite small (less than 100 entries),
but it can grow. Do you know if there exists some components that can help
in this task ?
The next step would be to code some letters automata but I have no time for
this.

Hi Jazzdrums,

the Html Agility Pack will help you!

http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx

Cheers

Arne Janning
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top