Lee Jenkins escreveu:
Luiz Americo Pereira Camara wrote:
Frank Church escreveu:
I am glad to see someone with an interest in FPCs XML. Do you have
some experience with XPath usage in PFC/Lazarus?



Luiz,

In Unit1.pas:

XPathResult := EvaluateXPathExpression('//Descricao', XmlTree.DocumentElement);
  if (XPathResult <> nil) then
  begin
    for i := 0 to XPathResult.AsNodeSet.Count - 1 do
    begin
      Node := TDOMNode(XPathResult.AsNodeSet[i]);
      if Node.FirstChild <> nil then
        Memo1.Lines.Add(UTF8Encode(Node.FirstChild.NodeValue));
    end;
    XPathResult.Destroy;
  end;
  XmlTree.Free;


Why the call to XPathResult.Destroy ? Is it for reference counting? Just seems something else to remember (use destroy instead of free)...

No special reason.

Free is redundant in this case since i already knows that XPathResult <> nil

Luiz


Thanks

--
Warm Regards,

Lee
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to