title: Delphi html parsing check if element has attribute
body: <p>I have the following procedure: </p>
  
  <pre><code>class procedure ParseData(AData: string; var ATextList: TList&lt;string&gt;);
  var
    HTMLDoc: OleVariant;
    HTMLElement: OleVariant;
    I: Integer;
  begin
    HTMLDoc := coHTMLDocument.Create as IHTMLDocument2;
    HTMLDoc.Write(AData);
    HTMLDoc.Close;
  
    for I := 0 to HTMLDoc.body.all.length - 1 do
    begin
      HTMLElement := HTMLDoc.body.all.item(I);
  
      if HTMLElement.hasAttribute('attr1') then
        ATextList.Add(HTMLElement.innerHTML);
    end;
  end;
  </code></pre>
  
  <p>The problem is that <code>hasAttribute</code> is not working. Funtions and proicedures like <code>setattribute</code>, <code>innerHTML</code>, <code>tagName</code> are working fine. Is there another way to check if an element contains given attribute?  </p>