On Wed, 21 May 2003 05:21 pm, Stefan Bodewig wrote: > > I've seen that Costin and Conor prefer that antlibs specify their URI > themselves. Could anybody please explain why - and at the same time > please also explain why user choice would be bad here? I feel I must > be missing something.
There area few reasons. I believe that if we are to distribute build files we need to know what libraries the build file makes use of. Only in this way can someone receiving the build file know what they are required to have to use the build files. Since libraries will be coming from anywhere and not centrally controlled, they need to be uniquely identified - the URI is one way of doing that - a good way. Now whether Ant uses the URI to find the antlib or the antlib declares itself to be available under a given URI is debateable. I prefer the latter as the mapping from URI to antlib is not dependent on the URI value - i.e. they are opaque. The mapping would need to be determined at some antlib loading phase and also as antlibs are declared in the build. OTOH, the former has the benefit of a load on demand. Another reason is that in XML, document writers do not make up arbitrary URIs. The URIs are associated with the particular spec (the definer of elements). The user only controls the prefix. > > > 2) what should ant do with URIs that it does not recognize? > > > > a) use current method - unknown elements > > b) ignore them > > c) explicty say that the ns uri is not supported > > d) convert them to Text in task/typedefs (the suggestion below) > > I'm on the fence between a) and b) and wouldn't like either c or d too > much. > I'd probably go fo (b) ignore them - just pass them as content. Conor