[Home] [By Thread] [By Date] [Recent Entries]



----- Original Message ----- 
From: "Rich Salz" <rsalz@d...>
To: "Karl Waclawek" <karl@w...>

> > > 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

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member