Thanks Peter. It helps ;-) --DD

> -----Original Message-----
> From: peter reilly [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 11:10 AM
> To: Ant Developers List
> Subject: Re: [Patch] namespace and antlib
> 
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to