[
Lists Home |
Date Index |
Thread Index
]
----- Original Message -----
From: "Rich Salz" <rsalz@datapower.com>
To: "Karl Waclawek" <karl@waclawek.net>
> > > 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
|