On Fri, 2 Nov 2007, Hess, Philip J wrote:

> Michael,
> 
> Thanks for pointing that out about ReadXMLFile. I see that my code has
> the same memory leak.
> 
> I think the confusion lies in that with Delphi once TXMLDocument has
> been used to create the object, the file is loaded by setting the
> object's FileName property, so it would appear logical to do the
> equivalent with FPC: call ReadXMLFile and pass the TXMLDocument object.
> But looking at the XmlRead.pp source I see that ReadXMLFile's
> TXMLDocument parameter is "out".
> 
> Another point of confusion is that the corresponding WriteXMLFile
> function takes an already-instantiated TXMLDocument, whereas ReadXMLFile
> does not.
> 
> Question: Is there any place where someone could know this without
> inspecting the XmlRead.pp source and understanding the implications of
> that "out" param?

No. There is not :/

I played with the idea to have the call instantiate a TXMLDocument only
when Nil is passed. The reason it is not implemented (yet) is that it
would be hard to detect errors in existing code. You would get an access
violation if an uninitialized document pointer would be passed...

Michael.


> 
> Thanks.
> 
> -Phil
> 
> 
> -----Original Message-----
> From: Michael Van Canneyt [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 02, 2007 1:20 PM
> To: [email protected]
> Subject: Re: [lazarus] DOM bug with 64 bit installation
> 
> 
> 
> On Fri, 2 Nov 2007, Alvise Nicoletti wrote:
> 
> > Hi... I finished to set up everything.
> > 
> > Lazarus is 0.9.23 well working (I had problems with printers and I
> just
> > uninstalled the packages into the "package list")
> > Fpc is 2.2.0 compiled from
> //svn.freepascal.org/svn/fpc/branches/fixes_2_2
> > (so 2.2.0 + bugfixes).
> > 
> > I'm getting:
> > In 'file:///etc/my.xml' (line 4 pos 5): Unmatching element end tag
> (expected
> > "</main>")
> > 
> > The file is:
> > cat /etc/my.xml
> > <configurazione>
> > <main>
> >   asd
> > </main>
> > </configurazione>
> > 
> > 
> > Can someone try to do:
> >  Document := TXMLDocument.Create;
> >  try
> >   ReadXMLFile(Document, "/etc/my.xml");
> >  on e:exception do WriteLn(e.message);
> >  end;
> > 
> > And report me back if it works or not?
> 
> Works fine here (after correcting the errors in your code) with the
> latest FPC.
> 
> A comment:
> Your code will leak memory. The ReadXMLFile call creates an instance of
> TXMLDocument and
> returns that. You should not instantiate one yourself.
> 
> Michael.
> 
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives
> 
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives
> 

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to