Lazarus

Free Pascal => FPC development => Topic started by: kinlion on May 25, 2019, 06:52:33 am

Title: [SOLVED]Compile Error: WriteXMLFile(xml_doc, file_name)
Post by: kinlion on May 25, 2019, 06:52:33 am
Lazarsu2.0.2 + FPC3.0.4 On Win10x64

I met with a weird problem:

The compiler compains: Incompatible type for the arg no.2: Got "AnsiString", Expected "TStream"
at this code:
Code: Pascal  [Select][+][-]
  1. WriteXMLFile(xml_doc, file_name);

However, if I use WriteXML instead, it has no problem.
I'm sure it's also no problem in Lazarsu1.8.4 + FPC3.0.4 On Win10x64 even using WriteXMLFile.

Is it a bug?
Title: Re: Compile Error: WriteXMLFile(xml_doc, file_name)
Post by: kinlion on May 25, 2019, 07:33:12 am
ReadXMLFile is similar
Title: Re: Compile Error: WriteXMLFile(xml_doc, file_name)
Post by: kinlion on May 25, 2019, 07:41:42 am
Sorry. I made a mistake.

The type of xml_doc should be TXMLDocument, but I defined it as a TDomDocument.
Title: Re: [SOLVED]Compile Error: WriteXMLFile(xml_doc, file_name)
Post by: ASerge on May 25, 2019, 07:45:32 am
This one compiles without a problem:
Code: Pascal  [Select][+][-]
  1. uses DOM, XMLWrite, XMLRead;
  2.  
  3. var
  4.   S: string = '';
  5.   Doc: TXMLDocument = nil;
  6. begin
  7.   WriteXMLFile(Doc, S);
  8.   ReadXMLFile(Doc, S);
  9. end.
Make a minimal project where the problem is reproduced.
TinyPortal © 2005-2018