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.

1
  • I think you can use Regex to extract the string or XDocument Commented Aug 14, 2012 at 9:00

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

i have tried using HtmlAgility library without any luck. Pherhaps i used i wrong but i tried to follow some examples without luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.