[fpc-pascal] XML Iteration

Lee Jenkins lee at datatrakpos.com
Wed Apr 28 15:48:46 CEST 2010


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)...

Thanks

--
Warm Regards,

Lee



More information about the fpc-pascal mailing list