Sto provando a selezionare div, span, etichette, ecc. In pratica qualsiasi elemento con un determinato attributo.
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants("div").Where(d => d.Attributes.Contains("itemtype"));
C'è un modo per legare tutti i discendenti in uno come sopra? Dal momento che sopra trova solo divs, ovviamente. Sto cercando di evitare il codice duplicato per aggiungere un'intera riga in più per sostituire una parola.
Per esempio (non funziona)
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants("*").Where(d => d.Attributes.Contains("itemtype"));
Provare:
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants()
.Where(d => d.Attributes.Contains("itemtype"));