XML: Differences between Delphi and FPC

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

XML: Differences between Delphi and FPC

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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XML: Differences between Delphi and FPC

Free Pascal - General mailing list

Am 30.07.2017 02:01 schrieb "Marcos Douglas B. Santos" <[hidden email]>:
>
> 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.

> 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XML: Differences between Delphi and FPC

Free Pascal - General mailing list

Am 30.07.2017 09:30 schrieb "Sven Barth" <[hidden email]>:
>
> Am 30.07.2017 02:01 schrieb "Marcos Douglas B. Santos" <[hidden email]>:
> >
> > 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XML: Differences between Delphi and FPC

Michael Van Canneyt
In reply to this post by Marcos Douglas B. Santos


On Sat, 29 Jul 2017, 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XML: Differences between Delphi and FPC

Marcos Douglas B. Santos
In reply to this post by Free Pascal - General mailing list
On Sun, Jul 30, 2017 at 4:30 AM, Sven Barth via fpc-pascal
<[hidden email]> wrote:
>> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XML: Differences between Delphi and FPC

Marcos Douglas B. Santos
In reply to this post by Michael Van Canneyt
On Sun, Jul 30, 2017 at 5:06 AM, Michael Van Canneyt
<[hidden email]> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Loading...