This project has moved and is read-only. For the latest updates, please go here.

Metro version and SelectNodes

Topics: Developer Forum
Jun 12, 2012 at 9:05 PM


I'm trying to do several tests on the version for Metro applications.
Much of the code I used so far is valid and that I miss in class HtmlNode SelectNodes method.

How can we select the contents of a node now?
Is it possible and has changed the way or not possible?

Thank you.

A greeting.

Jun 12, 2012 at 11:57 PM

Use Descendants() functions. Will have to use LINQ methods to do querying.

Unfortunately WinRT does not include any implementation of System.Xml.Xpath. Unlike Windows Phone the Silverlight 4 implementation cannot be used.

Hopefully at some point I may be able to use the Mono version.

Jun 14, 2012 at 7:14 AM

Thank you.

I've been testing using LINQ with good results. However there are methods that I can not get without using SelectNodes. Such as:

      var query = from table in doc.DocumentNode.SelectNodes ("/ / table"). Cast <HtmlNode> ()
                             from row in table.SelectNodes ("tr"). Cast <HtmlNode> ()
                             from cell in row.SelectNodes ("th | td"). Cast <HtmlNode> ()
                             select new {Table = table.Id, CellText = cell.InnerText};

Could anyone help me to adapt it using Descendants () functions and LINQ?

A greeting.