You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by peter reilly <pe...@corvil.com> on 2003/11/17 16:41:39 UTC

Ant 1.6 and namespace

Last week, I sent a questionary about
namespace support in ant 1.6.

http://marc.theaimsgroup.com/?l=ant-dev&m=106848848930806&w=2

>From the feedback, I think that we should
implement option b), nested elements of tasks/types
have the same namespace uri as the containing task/type,
unless they are typedefed elements.

For example:

<project xmlns:antcontrib="antlib:net.sf.antcontrib"
         xmlns:acme="antlib:org.acme.anttasks">
  <target name="show">
    <antcontrib:if>
        <antcontrib:or>
	    <antcontrib:equals arg1="yes" arg2="${prop}"/>
            <acme:fileready file="${file}"/>
        </antcontrib:or>
        <antcontrib:then>
           <echo>The arguments are equal</echo>
        </antcontrib:then>
    </antcontrib:if>
  </target>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant 1.6 and namespace

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 17 Nov 2003, peter reilly <pe...@corvil.com> wrote:

> From the feedback, I think that we should implement option b),

+1

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant 1.6 and namespace

Posted by peter reilly <pe...@corvil.com>.
On Monday 17 November 2003 16:11, Matt Benson wrote:
> --- peter reilly <pe...@corvil.com> wrote:
> > For example:
> >
> > <project xmlns:antcontrib="antlib:net.sf.antcontrib"
> >          xmlns:acme="antlib:org.acme.anttasks">
> >   <target name="show">
> >     <antcontrib:if>
> >         <antcontrib:or>
> > 	    <antcontrib:equals arg1="yes" arg2="${prop}"/>
> >             <acme:fileready file="${file}"/>
> >         </antcontrib:or>
> >         <antcontrib:then>
> >            <echo>The arguments are equal</echo>
> >         </antcontrib:then>
> >     </antcontrib:if>
> >   </target>
> > </project>
>
> Okay, how about redoing the same example with:
>
>     <antcontrib:if xmlns="antlib:net.sf.antcontrib">
> ...
>     </antcontrib:if>
>
> or will that syntax be available at all?
Yes, this is std xml (not visible from ant processing code):

<project xmlns:antcontrib="antlib:net.sf.antcontrib"
         xmlns:ant="antlib:org.apache.tools.ant"
         xmlns:acme="antlib:org.acme.anttasks">
   <target name="show">
     <if xmlns="antlib:net.sf.antcontrib">
         <or>
 	    <equals arg1="yes" arg2="${prop}"/>
            <acme:fileready file="${file}"/>
         </or>
         <then>
            <ant:echo>The arguments are equal</ant:echo>
         </then>
     </if>
   </target>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant 1.6 and namespace

Posted by Matt Benson <gu...@yahoo.com>.
Thanks to Peter and Chris.  Option B looks good to me
as well... this can also be called beta1 behavior,
which is less error-prone/confusing with macrodef
elements, for one thing.  Incidentally I'd probably
use the first example more often than not.

-Matt

--- Christopher Lenz <cm...@gmx.de> wrote:
> Matt Benson wrote:
> > --- peter reilly <pe...@corvil.com> wrote:
> > 
> >>For example:
> >>
> >><project
> xmlns:antcontrib="antlib:net.sf.antcontrib"
> >>         xmlns:acme="antlib:org.acme.anttasks">
> >>  <target name="show">
> >>    <antcontrib:if>
> >>        <antcontrib:or>
> >>	    <antcontrib:equals arg1="yes"
> arg2="${prop}"/>
> >>            <acme:fileready file="${file}"/>
> >>        </antcontrib:or>
> >>        <antcontrib:then>
> >>           <echo>The arguments are equal</echo>
> >>        </antcontrib:then>
> >>    </antcontrib:if>
> >>  </target>
> >></project>
> > 
> > Okay, how about redoing the same example with:
> > 
> >     <antcontrib:if
> xmlns="antlib:net.sf.antcontrib">
> > ...
> >     </antcontrib:if>
> > 
> > or will that syntax be available at all?
> 
> That should be:
> 
>    <if xmlns="antlib:net.sf.antcontrib">
>      ...
>    </if>
> 
> because the prefix mapping applies to the element it
> is defined on, in 
> addition to all child elements (as long as not
> overridden).
> 
> If you want child elements from the Ant core
> namespace, you'd need to map 
> that to a prefix, so the complete example would look
> like this:
> 
> <project xmlns:acme="antlib:org.acme.anttasks">
>    <target name="show">
>      <if xmlns="antlib:net.sf.antcontrib"
>          xmlns:ant="antlib:org.apache.tools.ant">
>          <or>
> 	    <equals arg1="yes" arg2="${prop}"/>
>              <acme:fileready file="${file}"/>
>          </or>
>          <then>
>             <ant:echo>The arguments are
> equal</ant:echo>
>          </then>
>      </if>
>    </target>
> </project>
> 
> Of course using a shorter prefix like 'ac' instead
> of 'antcontrib' also 
> helps to reduce verbosity ;-)
> 
> BTW, my non-binding +1 to option b).
> 
> -chris
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant 1.6 and namespace

Posted by Christopher Lenz <cm...@gmx.de>.
Matt Benson wrote:
> --- peter reilly <pe...@corvil.com> wrote:
> 
>>For example:
>>
>><project xmlns:antcontrib="antlib:net.sf.antcontrib"
>>         xmlns:acme="antlib:org.acme.anttasks">
>>  <target name="show">
>>    <antcontrib:if>
>>        <antcontrib:or>
>>	    <antcontrib:equals arg1="yes" arg2="${prop}"/>
>>            <acme:fileready file="${file}"/>
>>        </antcontrib:or>
>>        <antcontrib:then>
>>           <echo>The arguments are equal</echo>
>>        </antcontrib:then>
>>    </antcontrib:if>
>>  </target>
>></project>
> 
> Okay, how about redoing the same example with:
> 
>     <antcontrib:if xmlns="antlib:net.sf.antcontrib">
> ...
>     </antcontrib:if>
> 
> or will that syntax be available at all?

That should be:

   <if xmlns="antlib:net.sf.antcontrib">
     ...
   </if>

because the prefix mapping applies to the element it is defined on, in 
addition to all child elements (as long as not overridden).

If you want child elements from the Ant core namespace, you'd need to map 
that to a prefix, so the complete example would look like this:

<project xmlns:acme="antlib:org.acme.anttasks">
   <target name="show">
     <if xmlns="antlib:net.sf.antcontrib"
         xmlns:ant="antlib:org.apache.tools.ant">
         <or>
	    <equals arg1="yes" arg2="${prop}"/>
             <acme:fileready file="${file}"/>
         </or>
         <then>
            <ant:echo>The arguments are equal</ant:echo>
         </then>
     </if>
   </target>
</project>

Of course using a shorter prefix like 'ac' instead of 'antcontrib' also 
helps to reduce verbosity ;-)

BTW, my non-binding +1 to option b).

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant 1.6 and namespace

Posted by Matt Benson <gu...@yahoo.com>.
--- peter reilly <pe...@corvil.com> wrote:
> 
> For example:
> 
> <project xmlns:antcontrib="antlib:net.sf.antcontrib"
>          xmlns:acme="antlib:org.acme.anttasks">
>   <target name="show">
>     <antcontrib:if>
>         <antcontrib:or>
> 	    <antcontrib:equals arg1="yes" arg2="${prop}"/>
>             <acme:fileready file="${file}"/>
>         </antcontrib:or>
>         <antcontrib:then>
>            <echo>The arguments are equal</echo>
>         </antcontrib:then>
>     </antcontrib:if>
>   </target>
> </project>
> 


Okay, how about redoing the same example with:

    <antcontrib:if xmlns="antlib:net.sf.antcontrib">
...
    </antcontrib:if>

or will that syntax be available at all?

-Matt

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org