Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-07

XML: Differences between Delphi and FPC

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas B. Santos

Hi,

FPC/Lazarus always tried stay compatible with Delphi... thus, why the FPC XML classes is so different than Delphi classes?

Delphi XML is interface-based. There exists IXMLDocument, IXMLNode and so on. FPC has just classes.

I have a FPC/Lazarus project that will be compatible with Delphi. I would like to know whether I need to create wrappers to encapsulate the differences between them or there is a simple way to do that.

A 3rd lib could be an option too.

Thanks,
Marcos Douglas

Reply by email

Sven Barth
to Marcos Douglas B. Santos
"Marcos Douglas B. Santos" wrote 7 lines
Hi, FPC/Lazarus always tried stay compatible with Delphi... thus, why the FPC XML classes is so different than Delphi classes? Delphi XML is interface-based. There exists IXMLDocument, IXMLNode and so

on.

FPC has just classes.

Of I remember correctly IXMLDocument and the others are based on Microsoft's XML library. The authors of FPC's XML library probably didn't want to feel restricted by that.

Show quoted text 5 lines
I have a FPC/Lazarus project that will be compatible with Delphi. I would like to know whether I need to create wrappers to encapsulate the differences between them or there is a simple way to do that. A 3rd lib could be an option too.

You could provide wrappers that provide the same interfaces as the Delphi ones backed by FPC's library...

Regards,
Sven

Reply by email

Sven Barth
"Sven Barth" wrote 7 lines
Am 30.07.2017 02:01 schrieb "Marcos Douglas B. Santos" : > > Hi, > > FPC/Lazarus always tried stay compatible with Delphi... thus, why the > FPC XML classes is so different than Delphi classes?

Addendum: FPC's XML library probably also comes from a time when Delphi didn't have a standard library to deal with XML.

Regards,
Sven

Reply by email

Michael Van Canneyt
to Marcos Douglas B. Santos: FPC/Lazarus always tried stay compatible with Delphi... thus, why the FPC XML classes is…
Marcos Douglas B. Santos wrote
Hi, FPC/Lazarus always tried stay compatible with Delphi... thus, why the FPC XML classes is so different than Delphi classes?

Because the FPC classes predate the Delphi classes. They were based directly on the W3 DOM specifications.

Delphi XML is interface-based. There exists IXMLDocument, IXMLNode and so on. FPC has just classes.

The interfaces are needed only because Delphi uses the MS XML library, which is interface based. Since FPC does not use the MS XML library, it has no need of the interfaces.

I have a FPC/Lazarus project that will be compatible with Delphi. I would like to know whether I need to create wrappers to encapsulate the differences between them or there is a simple way to do that.

If I remember correctly, the WST project has a wrapper for delphi which acts like the FPC version. It's called wst_delphi_xml.

Michael.

Reply by email

Marcos Douglas B. Santos
to Sven Barth: on. Of I remember correctly IXMLDocument and the others are based on Microsoft's XML…
Sven Barth wrote 8 lines
> I have a FPC/Lazarus project that will be compatible with Delphi. I > would like to know whether I need to create wrappers to encapsulate > the differences between them or there is a simple way to do that. > > A 3rd lib could be an option too. You could provide wrappers that provide the same interfaces as the Delphi ones backed by FPC's library...

I'll probably do it. Thanks.

Regards,
Marcos Douglas

Reply by email

Marcos Douglas B. Santos
to Michael Van Canneyt: Because the FPC classes predate the Delphi classes. They were based directly on the W3…
Michael Van Canneyt wrote 10 lines
On Sat, 29 Jul 2017, Marcos Douglas B. Santos wrote: > FPC/Lazarus always tried stay compatible with Delphi... thus, why the > FPC XML classes is so different than Delphi classes? Because the FPC classes predate the Delphi classes. They were based directly on the W3 DOM specifications.

Ah, now it is clear.
I use XML classes in Delphi since version 4~5, whether I remember correctly. I didn't know that FPC XML was older.

The interfaces are needed only because Delphi uses the MS XML library, which is interface based. Since FPC does not use the MS XML library, it has no need of the interfaces.

Well, we can use interfaces even if we're not working with MS libraries. Interfaces and ref-count helps a lot but... anyway.

If I remember correctly, the WST project has a wrapper for delphi which acts like the FPC version. It's called wst_delphi_xml.
I saw. There are some alias and functions:
  TDOMNode = IDOMNode;
  TDOMNodeList = IDOMNodeList;
  //...
  function FindNode(ANode : TDOMNode; const ANodeName : string):TDOMNode;
  function GetNodeItemsCount(const ANode : TDOMNode): Integer;
  //...

I can do the same using interfaces and objects, providing just one API for the users, no matter they are Delphi or FPC programmers. Thanks for the tip, anyway.

Regards,
Marcos Douglas

Reply by email