Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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,
XML
<HTML><HEAD><TITLE>NCEDC_Search_Results</TITLE></HEAD><BODY>Your search parameters are:

<ul>
<li>start_time=2002/01/01,00:00:00
<li>end_time=2037/01/01,00:00:00
<li>minimum_magnitude=3.0
<li>maximum_magnitude=10
<li>etype=E
<li>rflag=A,F,H,I
<li>system=selected
<li>format=ncread
</ul>
<PRE>
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


</PRE>
</BODY></HTML>


XML
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();
doc.LoadHtml("E://text.html");
HtmlNode node = doc.DocumentNode;
HtmlNodeCollection pre = node.SelectNodes("//pre");
//var prenodes = doc.DocumentNode.SelectNodes("//pre");
if (pre != null)
{




}

Console.ReadKey();


}
hw to proceed further?
Posted
Updated 11-Jul-13 8:01am
v2
Comments
Sergey Alexandrovich Kryukov 10-Jul-13 14:42pm    
Not a question, just a work to be done. What help do you expect? Please start here: http://www.whathaveyoutried.com.

By the way, this "pre" form of XML majorly defeats the purpose of XML. This is pretty much the same as using text files.
—SA
Member 8657306 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900