Hi, I need to parse a page which has an article with different sections like Story, ContactInfo, Bibliography and so on. The whole data is stored in one column (text). Now I need to parse that article and store different sections (Story, ContactInfo, Bibliography) in to the new columns Story, ContactInfo, Bibliography and so on. Below is my code:
static void Main(string[] args)
{
Class1 obj = new Class1();
DataTable dt = obj.GetData();
string Story = string.Empty;
string Bibliography = string.Empty;
string ContactInformation = string.Empty;
string[] splitter1 = { " " };
string[] splitter2= {"div"};
foreach (DataRow DR in dt.Rows)
{ string data = DR["text"].ToString();
string[] chunck1 = data.Split(splitter1, StringSplitOptions.None);
string[] chunck2 = data.Split(splitter2, StringSplitOptions.None);
for (int i = 0; i < chunck1.Length; i++)
{
Story = chunck1[6]; Bibliography = chunck1[7];
ContactInformation = chunck2[9];
Console.WriteLine(Story);
Console.WriteLine(Bibliography);
Console.WriteLine(ContactInformation);
}
}
&
View Complete Post