[gdome]idom2 - libxml2 dom2 wrapper for object pascal



Hallo gdome,

as some of you might remember, I wrote a delphi/kylix wrapper for
gdome.
I wasn't satisfied with the result, as it had memory leaks and
the xpath support was missing (it was based on gdome 0.69).

So we deceided, to write a new dom2 wrapper from the scratch and
use libxml2 directly without gdome.

It was a lot of work (and there is still some work to be done yet),
but meanwhile I am quite happy with the result:

We have the unit idom2.pas, where the dom2 interfaces and a number
of extended interfaces are defined. And we have two or three
implementations for them, one based on libxml2, one based on
msxml, and hopefully more in the future.

My wrapper (libxmldomFE.pas) is faster then the microsoft parser
in all tests, in some tests, e.g. a tree walker it offers 300%
of the speed of msxml.
And - of course - it is much more dom compliant than msxml.
And it runs on linux.

I implemented some xpath support and xslt-support.
Also there are no more known memory leaks in libxmldomFe.pas.

Here are the interface definitions, we use for xpath (IDomNodeSelect)
and xslt (IDomNodeEx):

  IDomNodeSelect = interface
    ['{A50A05D4-3E67-44CA-9872-C80CD83A47BD}']
    function selectNode(const nodePath : DomString) : IDomNode;
    function selectNodes(const nodePath : DomString) : IDomNodeList;
    procedure registerNs(const prefix : DomString; const uri : DomString);
  end;
        
  IDomNodeEx = interface(IDOMNode)
    ['{17D937A2-C6EE-448F-8530-221D744AC083}']
    { Property Acessors }
    //function get_text: DOMString; safecall;
    //function get_xml: DOMString; safecall;
    //procedure set_text(const Value: DOMString); safecall;
    { Methods }
    procedure transformNode(const stylesheet: IDOMNode; var output: WideString); overload;
    procedure transformNode(const stylesheet: IDOMNode; var output: IDOMDocument); overload;
    { Properties }
    //property text: DOMString read get_text write set_text;
    //property xml: DOMString read get_xml;
  end;

In the moment we implemented about 95% of the dom2 methods, so there
is still some work left to be done.

Because we do a similar thing as the gdome project, just in a
different language, it might be interesting to exchange some ideas.

Just look at the code of libxmldomFE.pas (libxmldom.pas is a different
branch of the same thing, with a different memory management).

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/libxml2-pas/dom2/

In the moment we write a unit-test suite for testing the
dom-compliance. So far we have about 150 unit-tests, and we are
translating a more complete testsuite from ecma-script to object
pascal.

Any comments welcome:

Uwe





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]