You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Morten Mortensen <mo...@tietoenator.com> on 2003/08/02 19:50:00 UTC

RE: "echo"-task, ignorable whitespace and CDATA-elements

It will break things? That, of course, is between "bad" and "annoing".
But technically, I am right?

There are other people out there - e.g. me - who are trying to automate
things - reformatting XML, in particular Ant-files, and who refer to the XML
specification to see, what is and is not allowed.

I kind of think, that those Python-script-like-people should learn to use
CDATA-elements. That would solve the problem!?

Ant-files should be XML, not just pretend to. -Is my opinion.

Med venlig hilsen 
  Morten Sabroe Mortensen 
  TietoEnator A/S, Ved Lunden 12, 8230 Åbyhøj, Danmark 
  mailto:Morten.Mortensen@tietoenator.com 
  http://www.tietoenator.com


-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: 31. juli 2003 08:54
To: dev@ant.apache.org
Subject: Re: "echo"-task, ignorable whitespace and CDATA-elements


On Wed, 30 Jul 2003, Morten Mortensen
<mo...@tietoenator.com> wrote:

> It would be nice, if the "echo" task worked a bit different -
> actually *ignored* leading and trailing whitespace in the body of
> the text.

It may be possible to make that an option, but not the default IMHO.
I know a few build files that write files with <echo> or simply try to
pretty-format a message and we'd destroy the usecase.

> Example:
> 
> <echo>This is text!</echo>
> 
> - and -
> 
> <echo>
>   This is text!
> </echo>

If it didn't, it would be completely impossible to use <echo> to write
a Python script for example (yes, people do things like this).

Stefan

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

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


Re: "echo"-task, ignorable whitespace and CDATA-elements

Posted by Steve Loughran <st...@iseran.com>.
Morten Mortensen wrote:

> It will break things? That, of course, is between "bad" and "annoing".
> But technically, I am right?
> 
> There are other people out there - e.g. me - who are trying to automate
> things - reformatting XML, in particular Ant-files, and who refer to the XML
> specification to see, what is and is not allowed.

Well the rules are simple. Look at the XML spec, see that
"An XML processor must always pass all characters in a document that are 
not markup through to the application". That is what Ant expects, and 
this is used to lay out text:-

http://www.xml.com/axml/target.html#sec-white-space

There is nowhere in the XML spec that says "anything that processes XML 
is allowed to assume that the final destination of the XML does not care 
about white space".

And does care about white space in text elements, so if you have written 
code based on the assumption that it is irrelevant, then your assumption 
was invalid and your code doesnt work. Your problem, not mine.

> 
> I kind of think, that those Python-script-like-people should learn to use
> CDATA-elements. That would solve the problem!?

you mean 'breaking every single build file out there that used <echo> 
for formatted printing would solve the problem'? It is not going to 
happen. And, as far as I am concerned, not necessary.


> Ant-files should be XML, not just pretend to. -Is my opinion.

Ant is XML. It just happens to be sensitive about spaces in element 
content, is all. Which is something the XML specification explicitly allows.

If it wasnt valid XML, Ant wouldn't be parsable by XML parsers, or 
editable by XML editors. It is, therefore it is.


-Steve


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


Re: "echo"-task, ignorable whitespace and CDATA-elements

Posted by Stefan Bodewig <bo...@apache.org>.
On Sat, 2 Aug 2003, Morten Mortensen
<mo...@tietoenator.com> wrote:

> It will break things? That, of course, is between "bad" and
> "annoing".

Largely on the side of "bad" IMHO.

> But technically, I am right?

Sure.

Stefan

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