Recent

Author Topic: Is there a XML dom implementation for FPC and Delphi?  (Read 11535 times)

gerardus

  • Jr. Member
  • **
  • Posts: 93
Is there a XML dom implementation for FPC and Delphi?
« on: February 06, 2007, 05:33:01 pm »
Hi all,

I am developing an O/R Mapping framework. I started using Delphi, then I thought it would nice to have it working under FPC.
Does anybody know a XML DOM implementation that works both under Delphi and FPC?

Regards,

Gerard.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is there a XML dom implementation for FPC and Delphi?
« Reply #1 on: February 06, 2007, 08:23:30 pm »
Quote from: "gerardus"
Hi all,

I am developing an O/R Mapping framework. I started using Delphi, then I thought it would nice to have it working under FPC.
Does anybody know a XML DOM implementation that works both under Delphi and FPC?

Regards,

Gerard.


Delphi's units that implementation XML support (XmlIntf, XmlDoc) and FPC's units (DOM, XmlRead, XmlWrite) are roughly equivalent. Unfortunately the designers of FPC's didn't try to maintain Delphi compatibility in the naming of methods and properties and in how they're used. It's possible to write code that supports both by using IFDEF's. A better solution perhaps is to wrap calls to both in a separate unit and thus isolate the IFDEF's.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Is there a XML dom implementation for FPC and Delphi?
« Reply #2 on: February 06, 2007, 09:12:28 pm »
Quote from: "Phil"

Delphi's units that implementation XML support (XmlIntf, XmlDoc) and FPC's units (DOM, XmlRead, XmlWrite) are roughly equivalent. Unfortunately the designers of FPC's didn't try to maintain Delphi compatibility in the naming of methods and properties and in how they're used.


The fpc xml units were written in 1999-2000, Delphi 6 (released in 2002) was the first version to have XmlIntf.

It is hard to catch up with Delphi if they invent their own interfaces.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Is there a XML dom implementation for FPC and Delphi?
« Reply #3 on: February 06, 2007, 10:25:27 pm »
Quote from: "Vincent"
Quote from: "Phil"

Delphi's units that implementation XML support (XmlIntf, XmlDoc) and FPC's units (DOM, XmlRead, XmlWrite) are roughly equivalent. Unfortunately the designers of FPC's didn't try to maintain Delphi compatibility in the naming of methods and properties and in how they're used.


The fpc xml units were written in 1999-2000, Delphi 6 (released in 2002) was the first version to have XmlIntf.

It is hard to catch up with Delphi if they invent their own interfaces.


Actually, Delphi 6 was released in May, 2001. And FPC's DOM is based on Nov. 2000 DOM spec.

FPC's XML units have been worked on quite a bit since then. Actually, by adding a few methods and properties it would probably be possible to have a compatibility/wrapper unit that supports both Delphi and FPC. For example, with FPC declare this:

  IXMLDocument = TXMLDocument;
  IXMLNode     = TDOMNode;

Now at least those classes can be instantiated the same as Delphi. Etc.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: Re: Is there a XML dom implementation for FPC and Delphi
« Reply #4 on: February 06, 2007, 10:41:01 pm »
I think the fpc team would welcome patches like these to make it more Delphi compatible.

gerardus

  • Jr. Member
  • **
  • Posts: 93
Is there a XML dom implementation for FPC and Delphi?
« Reply #5 on: February 16, 2007, 09:06:29 pm »
Ok. Thanks all for your replies.
I am begining  to see the light now.
Being an absolute beginner in XML dind't help at all in comparing what was available in both worlds. :oops:
Delphi's IXMLNode is at a higher level than IDomNode, but it looks quite similar to FPC's TDomNode.
I think creating new classes in a separate unit with IFDEF's when needed is a good idea.
Sadly, a contribution to make FPC's implementation more compatible is beyond my reach now.

Have a nice weekend.

 

TinyPortal © 2005-2018