[gdome]RE: [gdome]Re: translation gdome.h to pascal



Hello,

I tried the suggestions of Tobias, but they didn't help:

The following code works fine:

Procedure Test1(str1,str2: string);
// Compares too strings; does work.
var name,name1: PGdomeDOMString;
    temp: Boolean;
begin
//exc:=ExceptionHandler;

  name:=gdome_str_mkref (pchar(str1));
  name1:=gdome_str_mkref (pchar(str2));
  temp:=gdomeBooleanToBoolean(gdome_str_equal(name,name1));

  ShowMessage(BooleanToString(temp));

  gdome_str_unref(name);
  gdome_str_unref(name1);
end;

So I can work with GDomeDOMImplementation and GdomeDOMString.

*************************************************************

This code works fine, too:

Procedure DomModuleChecker;
const
  ModuleName: array[0..6] of string     ('XML', 'Views', 'Events', 'CSS', 'Traversal', 'Range', 'HTML');
var i: integer;
    temp: string;
    domimpl: PGdomeDOMImplementation;
    exc:GdomeException;
    feature,version: PGdomeDOMString;
begin
  domimpl:=gdome_di_mkref; // create a domreference
  feature:=gdome_str_mkref (pchar(''));
  version:=gdome_str_mkref (pchar('2.0'));
  for i := 0 to 6 do
  begin
     feature.str:=pchar(ModuleName[i]);
     if gdome_di_hasFeature(domimpl,feature,version,@exc)<>0
       then temp:='Support for '+ModuleName[i]+' is included in this DOM
implementation.'
       else temp:='Support for '+ModuleName[i]+' is NOT included in this
DOM implementation.';
     Form1.Memo1.Lines.Add(temp)
  end;
  gdome_str_unref(feature);
  gdome_str_unref(version);
  gdome_di_unref(domimpl, @exc); // free the dom reference
end;

It does report, that only the Module XML is supported.
Is the module Events NOT supported???

One question about the exception handling.

Do the routines expect a pointer to a variable (@exc), that returns the
exception code,
or do they expect a pointer to a exception-handling procedure?

But as the code above does work, my declaration of GdomeException should
be ok.

This works ok, too:

procedure TForm1.Button9Click(Sender: TObject);
var domimpl: PGdomeDOMImplementation;
    exc:GdomeException;
begin
  domimpl:=gdome_di_mkref; // create a domreference
  gdome_di_ref(domimpl, @exc);
  gdome_di_unref(domimpl, @exc);
  gdome_di_unref(domimpl, @exc); // free the dom reference
  memo1.Lines.add('OK!');
end;

Then I am trying to use the following function:
  function gdome_di_parseFile(self:PGdomeDOMImplementation; uri:Pchar;
    exc:PGdomeException):PGdomeDocument;cdecl;external libgdome;

What shall I pass for uri on Windows?
Just the filename, or the filename with the full path, or what else?

The following code crashes:
(Acces violation in cygwin1.dll)

procedure TForm1.Button10Click(Sender: TObject);

var domimpl: PGdomeDOMImplementation;
    doc: PGdomeDocument;
    exc:GdomeException;
    name,name1,value: PGdomeDOMString;
    temp: GDomeBoolean;
    filename: string;
begin
  filename:='file://c:/events.xml';
  domimpl:=gdome_di_mkref; // create a domreference
  memo1.Lines.add(filename);
  doc:=gdome_di_parseFile(domimpl,pchar(filename),@exc); //chrashes
  gdome_di_freeDoc(domimpl,doc,@exc);
  gdome_di_unref(domimpl, @exc); // free the dom reference
end;


Is there a way to test cygwin1.dll?
Does anybody have a working trio of cywin1.dll, libxml2-2.45.dll and
libgdome-0.6.9.dll?

I think, that my headers are ok, but that there is a bug in one of my
dll's.

Any suggestions are wellcome.

Best regards:

Uwe Fechner
ufechner 4commerce de


> -----Original Message-----
> From: Tobias Peters [mailto:t-peters gmx de]
> Sent: Saturday, September 22, 2001 1:48 AM
> To: gdome gnome org
> Subject: Re: [gdome]Re: translation gdome.h to pascal
> 
> 
> On Fri, 21 Sep 2001, Uwe Fechner wrote:
> >   doc := gdome_di_createDocument(domimpl, NIL, name, NIL, @exc);
> [...]
> > If fails in the line doc:=...
> > The error message:
> > Access violation at address 610583D2 in module cygwin1.dll. Read of
> > address 00000010.
> 
> I'd start with simpler methods: gdome_di_ref, then gdome_di_parseFile.
> They have fewer or simpler parameters, so you can determine if it's a
> problem with the DOMImplementation object or with the DOMString.
> 
> >      Pgchar=pchar;      //could this be wrong?
> If your Compiler inserts a trailing NUL byte, it should be all right:
> 
> > pchar('TEST')
> should become 'TEST\0' in memory
> 
> Bye, Tobias
> 
> 
> 
> _______________________________________________
> gdome mailing list
> gdome gnome org
> http://mail.gnome.org/mailman/listinfo/gdome
> 





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