On Sun, Jun 27, 2010 at 10:35 AM, Dominique Devienne <ddevie...@gmail.com>wrote:
> On Sat, Jun 26, 2010 at 6:54 PM, Jon Stevens <latch...@gmail.com> wrote: > > For example, attr="&" comes out as attr="&" and not attr="&"... I > > don't have to write attr="&amp;" to get what I want. The same is true > > with attr=">"... it comes out as attr=">" instead of attr=">". This > is > > all because DOMElementWriter.encode() is smart about those entities. > > > > attr=" " should come out as attr=" ", not attr="\n" > > Well, I'm afraid Antoine is right, and the comparison you make is not > "fair". > > &, <, and > are "special" in XML, and must always be encoded in > attribute values and textual content. \n is not. > > <echoxml> never sees the "&" text, it sees whatever the XML parser > reports, a "&", and the XML serializer Ant uses knows it must encode > that char into "&", thus it ends up back the way it was. But 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. However, the character that went into the attribute was not a \n, it was a . I'd expect ant to give me back out, not \n. The point of <echoxml> is to echo xml, is it not? In that case, the point here should be to echo out the encoded value as xml, not something that is useless. jon