ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <>
Subject xml namespace support in ant2
Date Thu, 05 Sep 2002 10:08:05 GMT
I know this topic has been brought up before (e.g. in "Optional tasks"
thread of last december [1]), but I still wonder what is the actual plan for
the accepted requirement for Ant2.

At one point it was argued that using namespaces would yield to verbose
buildfiles.  But this all depends on what the namespaces would be used for.
In [1] it was suggested that there should be a defined namespace for Ant
(including <project>, <target>, core and optional tasks and datatypes) and
external tasks and datatypes would have to be declared in a separate
namespace.  With a namespace enabled <taskdef> a buildfile could look
something like this:

<project xmlns=""

 <taskdef qname="my:foo" classname=""/>
 <taskdef name="baz" ns="urn:my-ant-tasks" classname=""/>

 <target name="test">
  <echo message="test"/>
  <whatever:baz xmlns:whatever="urn:my-ant-tasks"/>


(Note the two different uses of <taskdef>.)

So for all those people not using custom tasks and datatypes the only
difference would be the default namespace declaration (or a prefixed one if

I was just thinking that if there were a namespace for all core Ant XML
elements it shouldn't be very hard to write up a RELAX NG grammar to
validate buildfiles, even with custom tasks and datatypes in it.  And the
gain of that in turn is probably quite obvious (although the RNG grammar
would require maintainance):
 - the task implementation would be guarded against wrong usage (validation)
 - the user wouldn't be surprised by different behaviour of tasks with just
swapped attribute order
 - and maybe a consistent documentation could be generated out of an
annotated grammar

Are namespaces intended for this kind of purpose in Ant2?




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