Ok my explaination was not that great ;-) 1) ant:core Namespace URI are not URLs.., they can be anything. The "ant" part is the "protocol" to use. I picked "ant:core" to look like "jelly:core" ;-). I used "ant:core" as it small and easy to remember. Normally one would not need to use it at all as it is the treated by PH2 as the default namespace. (Technically there is no sure thing as a default namespace but thats another story....). I would rather not put in a version number ;-) - The mythical ant2 may use a different namespace uri if necessary.
2) antlib:<package name> This is to allow the ant engine to locate the antlib resource file without being told explicity using typedef. The original idea of this came from Costin, (I cannot find the e-mail). One can use <typedef/> with this form, which means that the the antlib.xml does not need to be on the classpath. For example: <project xmlns:antcontrib="antlib:net.sf.antcontrib"> <typedef resource="net/sf/antcontrib/antlib.xml" uri="antlib:net.sf.antcontrib" classpath="/tmp/ant-contrib.jar"/> <antcontrib:foreach list="a,b,c,d,e" param="letter"> <sequential> <echo message="Letter ${letter}"/> </sequential> </antcontrib:foreach> </project> 3) reserved uri's The idea behind this is that ant will be extends soon to have aspects see: http://marc.theaimsgroup.com/?l=ant-dev&m=105767740420497&w=2 and maybe other things that need to be in different namespaces. I did want these names to be used in possible build scripts resulting in BC problems in the future. I did want the uri attribute of <typedef/> to be restricted to just ant:core and antlib:<anything>, but most people did not like that. 4) arbitary uris In combination with typedef one can use arbitary uris. <?xml version="1.0"?> <project xmlns:antcontrib="packages:antcontrib"> <typedef resource="net/sf/antcontrib/antlib.xml" uri="packages:antcontrib" classpath="/tmp/ant-contrib.jar"/> <antcontrib:foreach list="a,b,c,d,e" param="letter"> <sequential> <echo message="Letter ${letter}"/> </sequential> </antcontrib:foreach> 5) antlibs in the classpath If the antlib is in the classpath, and the antlib is in the correct location in the jar file, one can simply use: <project xmlns:antcontrib="antlib:net.sf.antcontrib"> <antcontrib:foreach list="a,b,c,d,e" param="letter"> <sequential> <echo message="Letter ${letter}"/> </sequential> </antcontrib:foreach> When the <classloader/> task works/is fixed, one should be able to use this to manipulate the classpath. 6) adding new definitions to a uri One can also add new defintions to a uri: <project xmlns:antcontrib="antlib:net.sf.antcontrib"> <typedef uri="antlib:net.sf.antcontrib" name="myecho" classname="org.apache.tools.ant.taskdefs.Echo"/> <antcontrib:outofdate> <sourcefiles path="build.xml"/> <targetfiles path="build.html"/> <sequential> <antcontrib:myecho>This is myecho</antcontrib:myecho> </sequential> </antcontrib:outofdate> </project> 7) xmlns does not need belong to the <project/> tag <project> <typedef uri="antlib:net.sf.antcontrib" name="myecho" classname="org.apache.tools.ant.taskdefs.Echo"/> <antcontrib:outofdate xmlns:antcontrib="antlib:net.sf.antcontrib"> <sourcefiles path="build.xml"/> <targetfiles path="build.html"/> <sequential> <antcontrib:myecho>This is myecho</antcontrib:myecho> </sequential> </antcontrib:outofdate> </project> Cheers, Peter On Friday 01 August 2003 16:02, Dominique Devienne wrote: > I'm confused Peter about the reserved URIs. When you say ant:core and > antlib:<package name>, you really are talking about the URIs, not the > namespace prefixes, right? > > If so, why is the ant:core URI so short, instead of the usual unique name > that result from using the DNS/URL name to Ant, with a version or date for > versioning purposes? It's the usual practice in XML isn't it? XSL does it > like that, no? > > And also, from the discussions we had, I thought that it was a bad practice > to mix URIs, which are solely there to uniquely identify a piece of > functionality, and specific info on how to load that functionality. > > I now realized, writing this, that antlib:<package name> is also a unique > name that doesn't imply how to load that AntLib, but you also write that > you'll look for a <package name>/antlib.xml, which implies it *must* be on > the classpath. I'm just hoping there is a separate mechanism that allows to > specific a classpath to use for a specific AntLib... > > I'm a big +1 to adding namespace support to Ant, > but a -0 to using ant:core as a URI, > and -1 to forcing AntLib's to be on Ant's classpath. > > --DD > > > -----Original Message----- > > From: peter reilly [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 01, 2003 7:30 AM > > To: [EMAIL PROTECTED] > > Subject: [Patch] namespace and antlib > > > > I have posted a patch for namespace support in > > > > http://issues.apache.org/bugzilla/show_bug.cgi?id=19897 > > > > It should cover most of the issues raised > > http://marc.theaimsgroup.com/?t=105289875900005&r=1&w=2 > > > > Arbitrary namespace uris are allowed, uris beginning with "ant" are > > reserved. > > > > ant:core is ant's namespace and the default namespace for > > definitions. > > > > antlib:<package name> is treated specially, when ant encounters a > > component (task, or type) that has a namespace uri of this form, > > ant will check if there is a resource of the name packege -> > > path/antlib.xml > > and if so it will load it up. > > > > Peter. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]