You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Krzysztof Kucybała <kk...@echo.fr> on 2007/08/24 10:12:45 UTC

Is & a somehow special character to Ant?

Hi,

I'm trying to use the exec task to issue a shell command, whose output 
to stderr and stdout I'd really like redirected to a file and the 
deleted, as it is not relevant and is corrupting my build report.
So this is what I run on the command line:

phpunit --log-xml somelog.xml MyCoolTest &>test.dump

On the shell it works fine, but when put to ant exec task I get this error:

The entity name must immediately follow the '&' in the entity reference.

Can anyone please tell me how to get around this? I tried escaping the & 
with \, but that's not working either :o( Thanks in advance for any help.

Best regards,
Krzysztof

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


Re: Is & a somehow special character to Ant?

Posted by James Fuller <ja...@gmail.com>.
to be more specific

http://www.xml.com/pub/a/2001/01/31/qanda.html

gl, Jim Fuller

On 8/24/07, Borut Hadžialić <bo...@gmail.com> wrote:
> & is special for xml because xml references start with &
>
> For your command you should use &amp; instead of &, or put the whole
> line inside <![CDATA[    ]]>, in which case you continue using & .
>
> On 8/24/07, Krzysztof Kucybała <kk...@echo.fr> wrote:
> > Hi,
> >
> > I'm trying to use the exec task to issue a shell command, whose output
> > to stderr and stdout I'd really like redirected to a file and the
> > deleted, as it is not relevant and is corrupting my build report.
> > So this is what I run on the command line:
> >
> > phpunit --log-xml somelog.xml MyCoolTest &>test.dump
> >
> > On the shell it works fine, but when put to ant exec task I get this error:
> >
> > The entity name must immediately follow the '&' in the entity reference.
> >
> > Can anyone please tell me how to get around this? I tried escaping the &
> > with \, but that's not working either :o( Thanks in advance for any help.
> >
> > Best regards,
> > Krzysztof
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
> --
> Why?
> Because YES!
>

Re: Is & a somehow special character to Ant?

Posted by Borut Hadžialić <bo...@gmail.com>.
& is special for xml because xml references start with &

For your command you should use &amp; instead of &, or put the whole
line inside <![CDATA[    ]]>, in which case you continue using & .

On 8/24/07, Krzysztof Kucybała <kk...@echo.fr> wrote:
> Hi,
>
> I'm trying to use the exec task to issue a shell command, whose output
> to stderr and stdout I'd really like redirected to a file and the
> deleted, as it is not relevant and is corrupting my build report.
> So this is what I run on the command line:
>
> phpunit --log-xml somelog.xml MyCoolTest &>test.dump
>
> On the shell it works fine, but when put to ant exec task I get this error:
>
> The entity name must immediately follow the '&' in the entity reference.
>
> Can anyone please tell me how to get around this? I tried escaping the &
> with \, but that's not working either :o( Thanks in advance for any help.
>
> Best regards,
> Krzysztof
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Why?
Because YES!

Re: Is & a somehow special character to Ant?

Posted by Robert Clark <ro...@quest.com>.
On Friday August 24, 2007, Krzysztof Kucybała <kk...@echo.fr> 
wrote:
> I'm trying to use the exec task to issue a shell command, whose
> output to stderr and stdout I'd really like redirected to a file
> and the deleted, as it is not relevant and is corrupting my build
> report. So this is what I run on the command line:
>
> phpunit --log-xml somelog.xml MyCoolTest &>test.dump

Since you are using the <exec/> task for this, look at the "output" 
and "error" properties of the task and let Ant do the redirecting for 
you instead of the shell.

For example: 

<exec executable="phpunit" output="test.dmp">
    <arg value="--log-xml"/>
    <arg value="somelog.xml"/>
    <arg value="MyCoolTest"/>
</exec>

(if error is not specified, but output is, then stdout and stderr will 
both be sent to the specified file)





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