Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:58:47+00:00 2026-06-15T02:58:47+00:00

So I’m trying to parse following data into a CSV. From my reading it

  • 0

So I’m trying to parse following data into a CSV. From my reading it sounds like the best way to go about it is using HAP since it has a robust parser.

As of right now, the WPF WebBrowser control content is being accessed by:

dynamic doc = this.wbControl.Document;

Content

        <div class="content">
                <fieldset>
                    <ul class="fieldsetr">
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Sender:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>me@example.com</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Recipient:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>me2@example2.com</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Message ID:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>2342342345235</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Message size:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>18.74 KB
                                    </em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Date and time received:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>11/27/2012 6:17:22 AM</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Date and time filtered:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>11/27/2012 6:17:22 AM</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <!-- Connector Details -->

                        </li>                            
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">First delivery attempt:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>11/27/2012 6:17:23 AM</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Final delivery attempt:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>11/27/2012 6:17:23 AM</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">From IP address:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>1.2.3.4 &lt;unknown&gt;</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">To IP address:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>4.3.2.1 &lt;mail.example2.com&gt; </em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium alt">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Filtering results:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <em>Passed Filtering</em>
                                </div>
                            </div>
                        </li>
                        <li class="row medium">
                            <div class="field">
                                <div class="shell">
                                    <em class="disable">Delivery result:</em>
                                </div>
                            </div>
                            <div>
                                <div class="clip">
                                    <span><em>Delivered: 470 2.4.0 &lt;2342342345235&gt; [InternalId=2321233] Queued mail for delivery</em></span>
                                </div>
                            </div>
                        </li>
                    </ul>
                </fieldset>
        </div>

What is the best way for me to convert this data? This is only one record, but more records would be added.

Edit

Ended up using the following code to test it out:

            HtmlAgilityPack.HtmlDocument docHAP = new HtmlAgilityPack.HtmlDocument();
            docHAP.LoadHtml(doc.Body.InnerHtml.ToString());

            foreach(HtmlNode emNode in docHAP.DocumentNode.SelectNodes("//em"))
            {
                MessageBox.Show(emNode.InnerText.ToString());
            }

If anyone has a more efficient solution, please feel free to let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:58:48+00:00Added an answer on June 15, 2026 at 2:58 am

    Yes, use the HTML Agilty Pack – it is an open source HTML parser for .NET.

    What is exactly the Html Agility Pack (HAP)?

    This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don’t HAVE to understand XPATH nor XSLT to use it, don’t worry…). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

    You can use this to query HTML and extract whatever data you wish.

    Simply by using XPath you can get any particular element/attribute/text data.

    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    doc.LoadHtml(this.wbControl.Document);
    
    // get all the 'em' tags from HTML
    foreach(HtmlNode emNode in doc.DocumentElement.SelectNodes("//em")
    {    
        if (emNode.Attributes["class"] != null)
           var value = emNode.Attributes["class"].Value;
    }
    
    // get all the `em` tags where 'class' attribute value is 'disable' from HTML
    foreach(HtmlNode emNode in doc.DocumentElement
                                  .SelectNodes("//em[@class='disabled']")
    {    
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.