[xml] xmlHash problem



Hello Daniel,

since I installed the new libxml2 version 2.4.23, the folling code doesn't
work
any more:


 1.  type

 2.     xmlHashTablePtr = ^xmlHashTable;

 3.     xmlHashEntryPtr = ^xmlHashEntry;
 4.     xmlHashEntry = record
 5.          next : xmlHashEntryPtr;
 6.          name : PxmlChar;
 7.          name2 : PxmlChar;
 8.          name3 : PxmlChar;
 9.          payload : pointer;
10.       end;

11.  {
12.     The entire hash table
13.    }
14.     pXmlHashEntryPtr=^xmlHashEntryPtr;
15.     xmlHashTable = record
16.          table : pXmlHashEntryPtr;
17.          size : longint;
18.          nbElems : longint;
19.       end;

20.  //
****************************************************************************


21.  function xmlGetHashEntry(hash: xmlHashTablePtr; index: integer):
pointer;
22.  // get a pointer to the content of a hash-entry with a given index
23.  // index = 0..HashLength-1
24.  // returns nil, if it doesn't exist
25.  var
26.    i,j: integer;
27.    //temp: string; // for debugging purposes
28.    hashEntry,next: xmlHashEntryPtr;
29.    p: pXmlHashEntryPtr;
30.  begin
31.    // we will count j from index downto zero
32.    // j:=index;
33.    // set the default result
34.    result:=nil;
35.    // check for invalid index
36.    if index<0 then exit;
37.    // we will count j from index downto zero
38.    j:=index;
39.    inc(j);
40.    // scan the hash
41.    if hash.table<>nil then begin
42.      for i:=0 to hash.size-1 do begin
43.        p := hash.table;
44.        Inc(p, i);
45.        hashEntry := p^;
46.        while hashEntry<>nil do begin
47.          next:=hashEntry.next;
48.          dec(j);
49.          // check if we found the entry with the correct index
50.          if j=0 then begin
51.            // return the result
52.            result:=hashEntry.payload;
53.            break;
54.          end;
55.          hashEntry:=next;
56.        end;
57.      end;
58.    end;
59.  end;


I need this function, to get access the named-node-map of entities and the
one
of the notations by index, and not by name.

So I need it, to implement some dom2-methods in our wrapper.

Ok, I adapted the code already to the changed xmlhash routines, but this
isn't a
clean solution (you might change the code in the future again).

Could you add an api-function to perform this task, or what other suggestion
do you have, to implement this function without using internal libxml2
structures?

Last question:

Is there an api function, to determine the version number of the active
libxml2 dll?

Regards:

Uwe




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