Exemple #1
0
        private static ConverterNode GetValue(HtmlNode node, string tag, string stoptag)
        {
            var result  = new ConverterNode();
            var sibling = node;

            result.Key = string.Empty;
            var tags = new List <HtmlNode>();

            while (sibling != null && !sibling.Name.Compares("h1"))
            {
                if (sibling.Name.Compares(tag))
                {
                    result.Key        = sibling.InnerText;
                    result.SerialNode = sibling;
                    result.TagNode    = new [] { sibling };
                    break;
                }
                var name = sibling.Descendants(tag);
                if (name.Any(o => o.Name.Compares(tag)))
                {
                    tags.AddRange(name);
                    result.SerialNode = sibling;
                }
                result.Key     = name.FirstOrDefault()?.InnerText;
                result.TagNode = tags;

                sibling = sibling.NextSibling;
                if (sibling == null || sibling.Name.Compares(stoptag))
                {
                    break;
                }
            }
            return(result);
        }
Exemple #2
0
 public void Visit(ConverterNode node)
 {
     AppendToResult(string.Format("SafeTypeConverter.Convert<{0}>(",
      GetCSharpType(node.DataTypeOut)));
     node.Parameter.AcceptVisitor(this);
     AppendToResult(")");
 }