css3-selectors

changeset 74:bee4e207de61 tip

Workaround a bug in Mono < 2.4 using Distinct() on nodesets
author Emanuele Aina <em@nerd.ocracy.org>
date Sun Mar 08 23:53:52 2009 +0100 (16 months ago)
parents 6a4ba19084b4
children
files tests/LxmlTestCssPy.cs
line diff
     1.1 --- a/tests/LxmlTestCssPy.cs	Tue Dec 30 22:54:31 2008 +0100
     1.2 +++ b/tests/LxmlTestCssPy.cs	Sun Mar 08 23:53:52 2009 +0100
     1.3 @@ -13,6 +13,16 @@
     1.4  
     1.5  using Css3Selectors;
     1.6  
     1.7 +public static class Extensions {
     1.8 +    public static List<XmlNode> ToList(this XmlNodeList nodes)
     1.9 +    {
    1.10 +        var ret = new List<XmlNode>();
    1.11 +        foreach(XmlNode node in nodes) {
    1.12 +            ret.Add(node);
    1.13 +        }
    1.14 +        return ret;
    1.15 +    }
    1.16 +}
    1.17  public static class LxmlTestCssPy {
    1.18      public static void Run()
    1.19      {
    1.20 @@ -60,7 +70,7 @@
    1.21                      }).ToXPath();
    1.22                      // Prefix the xpath expression with the current node, otherwise the <html> tag 
    1.23                      // will be matched too
    1.24 -                    count = html.SelectNodes("."+xpath, ns).Count;
    1.25 +                    count = html.SelectNodes("."+xpath, ns).ToList().Distinct().Count();
    1.26                  } catch (Exception e){
    1.27                      exception = e;
    1.28                  }

To download these repositories, get Mercurial and then type something like:

hg clone http://techn.ocracy.org/repository-name/

You can also click the "zip" or "gz" links to get an archive of the latest revision without installing anything.

The change logs of the repositories are aggregated at techn.ocracy.org/planet.

We have also some darcs repositories at techn.ocracy.org/darcs.