Re: [xml-dev] Refreshed genx.h, plus some plans

From
Karl Waclawek <>
To
Rich Salz <>
Date
2004-01-24T23:44:19Z
ID
<000901c3e2d3$fd0cfed0$0207a8c0@karl>
Thread
Re: [xml-dev] Refreshed genx.h, plus some plans
----- Original Message ----- 
From: "Rich Salz" <>
To: "Karl Waclawek" <>

> > > int genxDeclareNamespace(genxWriter w, utf8Byte * uri, utf8Byte *
> > > prefix);
> > >
> > > if prefix == NULL then genx will generate one.  prefix == "" is not
> > > allowed.
> >
> > What about default namespaces?
> 
> I'd do this.  Add this to your header:
>         extern char genxDEFAULT_NAMESPACE[1];
> and this to your implementation:
>         char genxDEFAULT_NAMESPACE[1] = { 0 };
> and then users do
>         int genxDeclareNamespace(w, "urn:foo:bar", genxDEFAULT_NAMESPACE);
> And then you do a pointer comparison to see if users passed in default.

To be somewhat symmetric one could define a NULL constant called
genxAUTO_PREFIX.
 
> BTW, the API doesn't have const-correctness yet.
>         /r$
> 
> > Maybe NULL should mean "default namespace", and you add a second function:
> >
> >   int genxDeclareAutoNamespace(genxWriter w, utf8Byte * uri);
> >
> > which auto-generates a prefix.
> 
> Again, a new "pointer constant" will remove the need for a new function.
> 

That in itself would not bother me much - there are already three
functions just for passing character data. Although it is more of
a problem in C, while in other languages you can overload a function name.

Karl