locked
How to parse HTML content in window8 c# and hyperlink between html contenet? RRS feed

  • Question

  • Hi

    I am getting html from rss feeds like this

    <div class="ms-rteForeColor-5 ms-rteFontSize-3 ms-rteThemeFontFace-2" style="line-height:14px;background-color:#ffffff;"><em><strong><span style="font-size:12pt;font-family:arial;color:#00cc00;"><img alt="" width=196 height=111 class=ms-rtePosition-1 src="http://htt.compass-usa.com/images/MS%20Office%202013%20logo.png" style="border:0px;float:left;margin:5px;width:160px;height:90px;"></span><span style="font-family:arial;"><br>
    <br>
    <span style="font-size:32px;color:#ff6600;">Introducing Office 2013!</span></span></strong></em><span style="font-size:12pt;font-family:arial;color:#90ee90;"><br class=ms-rteFontSize-4 style="font-size:18pt;color:#ff6600;">
    </span></div>
    <div style="color:#595959;font-size:small;line-height:14px;background-color:#ffffff;"><span style="font-family:arial;"><br>
    </span>
    <div><span style="font-family:arial;">Microsoft Office 2013® is now available and all existing systems will be automatically updated with this new version over the next few months!&#160; It has many new features and functions that will enhance your overall Office experience.&#160;&#160;&#160;<br>
    <br>
    The first thing you’ll see when you open Microsoft Office is a&#160;<em><strong>clean, new look</strong></em>. And all the features you know and use are still there—along with some new ones that are huge time savers!&#160;<br>
    </span></div>
    <ul style="">
        <li><span style="font-family:arial;">In&#160;<strong>Lync 2013</strong>, get real-time presence information—including availability status, and location—and enhanced instant messaging (IM) to connect efficiently and effectively.&#160; For more information, go&#160;<a href="https://mycompass.compass-usa.com/SiteCollectionDocuments/Systems%20Technology%20Group/STG%20Training%20Quick%20Reference/Microsoft%20Office%202013%20Reference%20Guides/Lync%20IM%20Presence%20Contacts.pdf" target=_blank style="text-decoration:none;color:#0000ff;">here</a>.&#160;<br>
        <br>
        </span></li>
        <li><span style="font-family:arial;">In&#160;<strong>Excel 2013</strong>, each workbook has its own window, making it easier to work on two workbooks at once. It also makes life easier when you’re working on two monitors.&#160; The new Quick Analysis tool lets you convert your data into a chart or table in two steps or less.<br>
        &#160;<br>
        You can preview your data with conditional formatting, sparklines, or charts, and make your choice stick in just one click.&#160; For more information on Excel 2013&#160;go&#160;<a href="https://mycompass.compass-usa.com/SiteCollectionDocuments/Systems%20Technology%20Group/STG%20Training%20Quick%20Reference/Microsoft%20Office%202013%20Reference%20Guides/Excel%202013.pdf" target=_blank style="text-decoration:none;color:#0000ff;">here</a>.&#160;</span></li>
    </ul>
    <div><span style="font-family:arial;">There are more also choices for getting started!&#160; Instead of seeing a blank file, you can now choose between a recent file and a favorite template for easier file sharing.&#160; There’s even a&#160;place in all of your Office programs, File &gt; Share, that puts together all your options for sharing your files with others.<br>
    <br>
    To view all of the&#160;quickstart guides for Office 2013, click&#160;<a href="https://mycompass.compass-usa.com/SiteCollectionDocuments/Systems%20Technology%20Group/STG%20Training%20Quick%20Reference/Microsoft%20Office%202013%20Reference%20Guides" target=_blank style="text-decoration:none;color:#0000ff;">here</a>.</span></div>
    <div><span style="font-family:arial;"><br>
    <strong>Online Training Available<br>
    <br>
    </strong>STG, in partnership with Microsoft, has made on-line training courses for Office 2013® available to all associates for the various components.&#160; These courses are free, offered online, and provide introductory to intermediate level instruction.&#160; View a complete list of courses available&#160;<a class=ms-rteFontSize-2 href="https://mycompass.compass-usa.com/SiteCollectionDocuments/Systems%20Technology%20Group/STG%20Training%20Quick%20Reference/Microsoft%20Office%202013%20Reference%20Guides/Office%202013%20Online%20Training%20Directions%20Courses.pdf" target=_blank style="font-size:10pt;text-decoration:none;color:#0000ff;">here</a>.&#160;&#160;<br class=ms-rteFontSize-2 style="font-size:10pt;">
    <br class=ms-rteFontSize-2 style="font-size:10pt;">
    If you have any questions about this upgrade, please contact&#160;<span style="font-size:13px;color:#0000ff;"><a href="http://compass-usa.com">Office2013@compass-usa.com</a></span></span></div>
    </div><br><a href="http://itfinance.compass-usa.com/cms/httfeeds/tabid/86/EntryId/8/Introducing-Microsoft-Office-2013.aspx">More ...</a>

    I am parsing this from HtmlUtilities.ConvertToText(item.Summary.Text).Replace("\r\n", string.Empty)

    but from this it returns while conent as a paragraph but here inside this html content we have hyperlink and images so how can I get that link of hperlink and how I identify that this particular keywords has hyperlink so that I can displayed that word as hyperlink between dataTemplate.

    please suggest me.

     and let me know If have any concern from me


    sandeep chauhan

    • Moved by Eason_H Friday, January 17, 2014 8:53 AM
    Thursday, January 16, 2014 7:44 AM

Answers

  • Hi Sandeep,

    I’m afraid that it is not the correct forum about this issue, since this forum is to discuss Visual C#. I suggestion you post the question in the ASP.NET forums at http://forums.asp.net/. It is appropriate and more experts will assist you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Thursday, January 23, 2014 11:08 PM
    • Marked as answer by Just Karl Monday, February 3, 2014 6:45 PM
    Friday, January 17, 2014 8:53 AM
  • Regular expressions are meant to server your requirement.

    http://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    • Proposed as answer by S.Sriram Thursday, January 16, 2014 12:29 PM
    • Marked as answer by Just Karl Monday, February 3, 2014 6:45 PM
    Thursday, January 16, 2014 10:00 AM

All replies

  • Regular expressions are meant to server your requirement.

    http://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx


    Happy Coding.

    Regards,
    Jaliya Udagedara (MCPD,MCSD) | My Blog

    • Proposed as answer by S.Sriram Thursday, January 16, 2014 12:29 PM
    • Marked as answer by Just Karl Monday, February 3, 2014 6:45 PM
    Thursday, January 16, 2014 10:00 AM
  • Use this code:

    string strRegex = @"<a.*?</a>";
    Regex myRegex = new Regex(strRegex, RegexOptions.None);
    htmlString = YOUR HTML STRING
    foreach (Match min myRegex.Matches(htmlString))
    {
      if (m.Success)
      {
        // Add your code here
      }
    }
    

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...

    Thursday, January 16, 2014 11:56 AM
  • Hi

    thnks for reply!

    but it not what I need.

    I have HTML content with some hyperlink, bold and normal content etc. I have display this mixture of content into gridview's data template.

    please suggest me


    sandeep chauhan

    Friday, January 17, 2014 8:49 AM
  • Hi Sandeep,

    I’m afraid that it is not the correct forum about this issue, since this forum is to discuss Visual C#. I suggestion you post the question in the ASP.NET forums at http://forums.asp.net/. It is appropriate and more experts will assist you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Thursday, January 23, 2014 11:08 PM
    • Marked as answer by Just Karl Monday, February 3, 2014 6:45 PM
    Friday, January 17, 2014 8:53 AM