Recent

Author Topic: [SOLVED]Compile Error: WriteXMLFile(xml_doc, file_name)  (Read 1491 times)

kinlion

  • Jr. Member
  • **
  • Posts: 82
  • I Love Lazarus
[SOLVED]Compile Error: WriteXMLFile(xml_doc, file_name)
« 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?
« Last Edit: May 25, 2019, 07:42:24 am by kinlion »

kinlion

  • Jr. Member
  • **
  • Posts: 82
  • I Love Lazarus
Re: Compile Error: WriteXMLFile(xml_doc, file_name)
« Reply #1 on: May 25, 2019, 07:33:12 am »
ReadXMLFile is similar

kinlion

  • Jr. Member
  • **
  • Posts: 82
  • I Love Lazarus
Re: Compile Error: WriteXMLFile(xml_doc, file_name)
« Reply #2 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.

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: [SOLVED]Compile Error: WriteXMLFile(xml_doc, file_name)
« Reply #3 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