[fpc-pascal] XML Iteration
Luiz Americo Pereira Camara
luizmed at oi.com.br
Thu Apr 29 04:08:45 CEST 2010
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 at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
More information about the fpc-pascal
mailing list