Ejemplo n.º 1
0
 private IEnumerable<IMicrodataNode> GetPropertiesRecursive(HtmlAgilityPack.HtmlNode node)
 {
     var itempropAttr = node.GetAttributeItemProperty();
     if (itempropAttr != null)
     {
         // If this has an itemscope then return an item, otherwise a property
         // This is because item iterates appropriately for the xml expected
         var itemscopeAttr = node.GetAttributeItemScope();
         yield return (itemscopeAttr != null)?
              (IMicrodataNode)new Item(node) :
              (IMicrodataNode)new Property(node, itempropAttr);
         yield break;
     }
     foreach (var childNode in node.ChildNodes)
     {
         foreach (var property in GetPropertiesRecursive(childNode))
         {
             yield return property;
         }
     }
 }