Re: [xml] print a xmlHashTable

David wrote:

I want to use the great xmlHashTable from the libxml2 library but i cant
seem to print out its elements. Who knows how to deal with this problem?

Code example
xmlHashTablePtr hashtable;
int i = 0;
hashtable = xmlHashCreate(1);
xmlHashAddEntry(hashtable, "keyno1", i++);
xmlHashAddEntry(hashtable, "keyno2", i++);

- what does the the first parameter of xmlHashCreate do?

Enlightenment can often by achieved through the application of the
well-known expression RTFM :-) :
Similar information can be gleaned from include/libxml/hash.h, not to
mention the comments in the source code (hash.c).

- how do i print out all key/value pairs of the hashtable? (whitout
knowlede of the key name in the hashtable)

Looking through the available hash functions, I'd say that
xmlHashScanFull may well fulfill your wishes, if you write a very simple
callback function to print the data presented to the callback.

Cheerz, David


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