Exemplo n.º 1
0
        private void RunSelectQuery(SelectQuery sq)
        {
            ScrapeQLQueryable node;
            bool inscope = scope.TryGetValue(sq.Source.Value.AsString(), out node);

            if (inscope)
            {
                Selector          s        = sq.Selector;
                ScrapeQLQueryable selected = null;
                if (s is AttributeSelector)
                {
                    selected = node.SelectSingleNode((s as AttributeSelector).Xpath.Value.AsString());
                    if (selected != null)
                    {
                        scope.Add(sq.Alias.Value.AsString(), selected);
                    }
                    else
                    {
                        Console.WriteLine(String.Format("Could not select: {0}", (s as AttributeSelector).Xpath.Value.AsString()));
                    }
                }
                if (s is SelectorString)
                {
                    selected = node.SelectSingleNode((s as SelectorString).Xpath.Value.AsString());
                    if (selected != null)
                    {
                        scope.Add(sq.Alias.Value.AsString(), selected);
                    }
                    else
                    {
                        Console.WriteLine(String.Format("Could not select: {0}", (s as SelectorString).Xpath.Value.AsString()));
                    }
                }
            }
            else
            {
                Console.WriteLine(sq.Source.Value.AsString() + " is not in scope at:" + sq.Source.Location.ToString());
            }
        }
Exemplo n.º 2
0
 public ScrapeQLQueryable Combine(ScrapeQLQueryable append)
 {
     return(new ImmutableListQueryable(this, append));
 }