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

Topics: Developer Forum, User Forum
Jan 29, 2013 at 12:20 PM
Edited Jan 29, 2013 at 12:20 PM

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 12:33 PM

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();
            hp.LoadHtml(lines);

            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 http://www.w3schools.com/xpath/xpath_syntax.asp

Jan 29, 2013 at 2:34 PM

thanks very much.