Re: [xml] Hash question: behavior of a hash with xmlHashAddEntry and xmlHashAddEntry2 types



On Mon, Mar 19, 2007 at 02:56:45PM -0500, David Hagood wrote:
Given that I have created a hash with xmlHashCreate:

1) Is it valid to populate it with calls to both xmlHashAddEntry and
xmlHashAddEntry2 - in other words, having entries with one or two strings.
2) What is the behavior of xmlHashLookup and xmlHashLookup2 in such a case?

For example, is the following code valid?

xmlHashAddEntry2(hash,BAD_CAST "Smokey",BAD_CAST "Bear",&bear);
xmlHashAddEntry(hash,"Smokey",&bandit);

And if so, what will  xmlHashLookup(hash,BAD_CAST "Smokey") return?

The hash documentation isn't clear on whether this is valid or not.

  That should be valid xmlHashAddEntry is a call to xmlHashAddEntry3 
with 2 extra NULL args, and xmlHashLookup is a call to xmlHashLookup3
with 2 extra NULL args, everything is done internally with 3 args.
Note however that I never tried to mix in libxml2 code itself.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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