Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# HTML Parsing
I am working on a project wherein I have to extract data from a website & store in acess. I am able to read data from a website & store it in html doc but now I want to parse the html doc & store in access. The following are the contents of the html file,
<HTML><HEAD><TITLE>NCEDC_Search_Results</TITLE></HEAD><BODY>Your search parameters are:
Date       Time             Lat       Lon  Depth   Mag Magt  Nst Gap  Clo  RMS  SRC   Event ID
2002/01/10 00:44:51.53  40.4415 -126.0167  25.37  3.92   Md   56 269  147 0.29 NCSN   21208454
2002/01/12 04:41:46.93  36.7690 -121.4812   7.74  3.06   Md   54  35    5 0.09 NCSN   21208721
2002/01/12 21:52:50.82  41.1998 -124.2370  18.97  3.32   ML   11 226   19 0.03 NCSN   21208790
2002/01/16 15:29:20.88  35.7650 -121.2815   5.72  3.24   ML   47 149    6 0.09 NCSN   21209284

I want the contents between <pre></pre> tag. The column names are as given in the above html docs.
How can I achieve this using Html Agility Pack in C#?
i tried this code
string txt=null;
HtmlDocument doc = new HtmlDocument();
HtmlNode node = doc.DocumentNode;
HtmlNodeCollection pre = node.SelectNodes("//pre");
//var prenodes = doc.DocumentNode.SelectNodes("//pre");
if (pre != null)




hw to proceed further?
Posted 10-Jul-13 8:39am
Edited 11-Jul-13 9:01am
Sergey Alexandrovich Kryukov at 10-Jul-13 14:42pm
Not a question, just a work to be done. What help do you expect? Please start here:
By the way, this "pre" form of XML majorly defeats the purpose of XML. This is pretty much the same as using text files.
Member 8657306 at 11-Jul-13 13:51pm
i want the method/technique to approach this prob..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100