[Gambas-devel] Component using Collection object

Christian Faure christian.faurebouvard at ...156...
Sun Sep 5 15:23:03 CEST 2004


> To put a string in the collection, you can do the same way, by just
> changing some constants and types. This should work :-)
>
> GB_STRING result;
>
> result.type = GB_T_CSTRING;
> result._string.addr = attr_name;
> result._string.start = 0;
> result._string.len = strlen(attr_name);
> GB.Conv((GB_VALUE *)&result, GB_T_VARIANT);
> GB.Collection.Set(THIS->table, key, key_len, (GB_VARIANT *)&result);
>

Ok, using:

     GB_STRING v;
     v.type = GB_T_CSTRING;
     v.value.addr = atts[i+1];
     v.value.start = 0;
     v.value.len = strlen(atts[i+1]);
     GB.Conv((GB_VALUE *)&v, GB_T_VARIANT);
     GB.Collection.Set(col, atts[i], strlen(atts[i]), (GB_VARIANT *)&v);

work ok. Thanks!  No extra api needed.

> Just a few remarks :-)
>
> 1) What is the difference betweens expat and libxml2 ? Why using expat and
> not libxml2 ?

libxml2 is a complete xml toolkit 
expat is only a very simple parser.

At this moment, only need a very simple parser, and already know it from PHP 
extension.

>
> 2) When you are finish the component, I will ask you to change your
> interface, i.e. the names you use, which are not very good.
>
> For example, the name of the class is "Expatc", which is bad, as it is the
> name of the library. You must use something like "XMLParser", which is
> generic. This way, if there is another XML component based on a different
> library, they will be able to share the same interface so that the user
> don't have to change its code.

Ok, 

>
> There are other problems, but finish your work without thinking about that.
> I will tell you later.

Ok

Thanks again.




More information about the Devel mailing list