how to get all the spans that has class = "xyz"

Topics: Developer Forum, User Forum
Jan 29, 2013 at 11:20 AM
Edited Jan 29, 2013 at 11:20 AM

Hi guys,

i have telerik editor and creating my custom tags 

i want to extract all the spans that has class = "xyz" 

how can i do that ? 


i wished to have documentation for this great dll

Jan 29, 2013 at 11:33 AM

what you do is check the attributes using @ for the attribute

            StreamReader sr = new StreamReader(@"C:\Development\sample.htm");
            string lines = sr.ReadToEnd();

            HtmlDocument hp = new HtmlDocument();

            var nodes = hp.DocumentNode.SelectNodes("//span[@class='xyz']");
            foreach (var item in nodes)
                var xyz = item.InnerText;

good information on xpath can be found here

Jan 29, 2013 at 1:34 PM

thanks very much.