HtmlControlType

HtmlControlType enumeration

Tipo di nodi del documento che rappresentano gli elementi <input> e <select> importati da HTML.

public enum HtmlControlType

I valori

NomeValoreDescrizione
FormField0Un campo modulo.
StructuredDocumentTag1Un tag di documento strutturato

Esempi

Mostra come impostare il tipo preferito di nodi del documento che rappresenteranno gli elementi <input> e <select> importati.

const string html = @"
    <html>
        <select name='ComboBox' size='1'>
            <option value='val1'>item1</option>
            <option value='val2'></option>
        </select>
    </html>
";

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PreferredControlType = HtmlControlType.StructuredDocumentTag;

Document doc = new Document(new MemoryStream(Encoding.UTF8.GetBytes(html)), htmlLoadOptions);
NodeCollection nodes = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);

StructuredDocumentTag tag = (StructuredDocumentTag) nodes[0];

Guarda anche