ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <knut.wannhe...@paranor.ch>
Subject RE: polymorphism (was Re: antlib)
Date Sun, 27 Apr 2003 21:14:23 GMT
> 
> Or even:
>   <antelope:if xmlns:antelope="antlib:${ant-contrib.jar}" />
> 

That syntax abuses the purpose of XML Namespaces, IMO.  Although a namespace
is identified by an URI, I don't think attaching semantics to it is correct.
Also, would ProjectHelper2 (using SAX2) resolve property references in
namespace declarations?  Questionable whether that should be allowed, no?
IMHO it is cleaner to require explicit loading (maybe even unloading) of
antlibs using a task like <antlib/>.  That would better correspond to how
<taskdef/> works.  But nevertheless, I think it's a good idea to associate a
namespace with every antlib.  If the antlib defines a namespace to use in
its descriptor (e.g. "antlib:antelope" for antlib "antelope") then loading
an antlib could be as simple as:

	<antlib resource="${antelope.jar}"/>
	<if xmlns="antlib:antelope"/>

but maybe the buildfile author wants/needs to specify the namespace URI
(anything really), in which case an additional "ns" attribute could be used:

	<antlib resource="${foo.jar}" ns="urn:antlib:foo"/>
	<foo:bar xmlns:foo="urn:antlib:foo"/>

Cheers,

--
knut

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message