[fpc-pascal] XML: Differences between Delphi and FPC

Marcos Douglas B. Santos md at delfire.net
Sun Jul 30 15:36:14 CEST 2017


On Sun, Jul 30, 2017 at 5:06 AM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
> 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



More information about the fpc-pascal mailing list