Skip to main content
deleted 1 character in body
Source Link

There are many approaches to this from using regex to web scrappingscraping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/text()").ToList().ForEach(x=>MessageBox.Show(x.InnerHtml));
        }

There are many approaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/text()").ToList().ForEach(x=>MessageBox.Show(x.InnerHtml));
        }

There are many approaches to this from using regex to web scraping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/text()").ToList().ForEach(x=>MessageBox.Show(x.InnerHtml));
        }
deleted 16 characters in body
Source Link

There are many approaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/span[@class=\"price\"]"text()").ToList().ForEach(x=>MessageBox.Show(x.InnerTextInnerHtml));
        }

There are many approaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/span[@class=\"price\"]").ToList().ForEach(x=>MessageBox.Show(x.InnerText));
        }

There are many approaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/text()").ToList().ForEach(x=>MessageBox.Show(x.InnerHtml));
        }
added 693 characters in body
Source Link

thereThere are many approachapproaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/span[@class=\"price\"]").ToList().ForEach(x=>MessageBox.Show(x.InnerText));
        }

there are many approach to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath.

There are many approaches to this from using regex to web scrapping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath. add reference and namespace to HtmlAgilityPack and i 'm using linq(this requires .net 3.5 or better) with the code below you can do that.

using HtmlAgilityPack;
using System.Linq;

// these references must be available.

        private void Form1_Load(object sender, EventArgs e)
        {
            var rawData = "<p><span>Child Text </span><span class=\"price\">Child Text</span><br />I need this text</p>";
            var html = new HtmlAgilityPack.HtmlDocument();
            html.LoadHtml(rawData);
            html.DocumentNode.SelectNodes("//p/span[@class=\"price\"]").ToList().ForEach(x=>MessageBox.Show(x.InnerText));
        }
Source Link
Loading