0

I am working on a problem. I am going to extract som HTML text and store them as Anchor object. For example:

<html>
<head>
<title>{dynamihead/}</title>
</head>

<body>
{repeatinghtml}
<p>{repeatinganchor1/}</p>
<p>{repeatinganchor2/}</p>
<p>{repeatinganchor3/}</p>
<p>{repeatinganchor4/}</p>
{/repeatinghtml}
</body>
</html>

I want to extract the {} anchor. If its a selfterminating achour i want to create {dynamihead/} just this anchor object. But if its contain childAnchours i want to extract like

{repeatinghtml}
    <p>{repeatinganchor1/}</p>
    <p>{repeatinganchor2/}</p>
    <p>{repeatinganchor3/}</p>
    <p>{repeatinganchor4/}</p>
{/repeatinghtml}

i want to extract all the child anchours and put the in a collection in the main anchor. I have defiend the Anchor class, but i im not so skilled at string handling so im having trouble extracting the text that i want. This is a winform application that is going to load a template hmlt file, proccess it and instert information into the ancours and the send a email i html format.

Oyvind
  • 55
  • 1
  • 4

1 Answers1

1

Try to look at HtmlAgility library. Even if it looks simpler at a first glance there is a lot of reasons to avoid using regex for such problems, and eighter string manipulation will probably not suffice.

Community
  • 1
  • 1
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
  • i have tried using HtmlAgility library without any luck. Pherhaps i used i wrong but i tried to follow some examples without luck. – Oyvind Aug 14 '12 at 10:20