Search() 공개 메소드

public Search ( string selector ) : Node[]
selector string xpath or css
리턴 Node[]
예제 #1
0
        private static string[] TextOrEmpty(Nokogiri.Node node, string selector)
        {
            var nodes = node.Search(selector);

            return(nodes == null || !nodes.Any()
                ? new string[0]
                : nodes.Select(n => n.Text).ToArray());
        }
예제 #2
0
        private string[] PossibleNumberPattern(Nokogiri.Node node)
        {
            var nodes = node.Search("fixedLine possibleLengths").FirstOrDefault();

            if (nodes != null)
            {
                return(new string[] { $"\\d{{{(nodes["localOnly"]+","+nodes["national"]).Trim(',')}}}" });
            }

            return(new string[] {});
        }
예제 #3
0
        private IEnumerable <string[]> ExampleNumbersForTerritoryNode(Nokogiri.Node node)
        {
            var name = TerritoryName(node);

            if (name == "001")
            {
                return new[] { new string[0] }
            }
            ;
            return(node.Search(example_numbers_selector())
                   .Select(node1 => new[] { node1.Text, name })
                   .ToArray());
        }