On Tue, Mar 12, 2013 at 11:17 AM, Daniel Gaspary <dgasp...@gmail.com> wrote: > Using Xpath I believe would be something like this:
I was missing an If: function ElementById(id: string; doc: TXMLDocument): TDOMElement; var v: TXPathVariable; begin result:=nil; try v:=EvaluateXPathExpression('//*[@id=' + QuotedStr(id)+']', doc.DocumentElement); with v.AsNodeSet do begin if Count>0 then result:=TDOMElement(Items[0]); end; finally FreeAndNil(v); end; end; _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal