ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <jesse.gl...@oracle.com>
Subject Re: bug in DOMElementWriter
Date Mon, 28 Jun 2010 18:05:42 GMT
On 06/27/2010 01:35 PM, Dominique Devienne wrote:
> with \n, which is just like any other character*, the serializer doesn't do
> anything special, and the output the also contain a "plain" \n.

Jon is correct: &#10; or similar should be emitted for \n. Newlines are _not_ just like
any other character; in XML attributes they are collapsed into a generic 
whitespace sequence. For example,

<project default="run">
     <target name="run">
     <echo message="hello
there"/>
     <echo message="hello&#10;again"/>
     </target>
</project>

prints

hello there
hello
again

In general, there is a certain class of characters other than the usual &<>"' which
should be emitted in character entity form by any tool which purports to create 
round-trippable XML. Others, like &#8;, are simply invalid in XML content and cannot be
encoded at all.


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


Mime
View raw message