View Full Version : Phrasing HTML by Style

08-07-2012, 05:58 AM

I am trying to do some HTML Phrasing. I have been trying various different things (xpath, mshtml, regex) to find something in my HTML document. But I am not having much luck. I am currently coding in VB and C#.

What to know if there is a better method? If so what would an example look like?

I am looking for the next instance of a hyperlink that follows after some text that has a inline style format. The html would look like this:

<p> Some Text <span style="color:black;background-color:gray">My Text</span> More Text</p><p>More Text <a href="">Item123</a> More Text </p>

I want to return "Item123" from within the <a href=""></a>

Everything before the <span> with my specific style can be ignored. I want to find the first instance of <a href=""> after the </span>.


08-14-2012, 12:40 PM
Try HtmlAgilityPack (http://htmlagilitypack.codeplex.com/). It allows you to use xPath with HTML pages, which aren't really a well-formed XML document.