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="&amp;" comes out as attr="&amp;" and not attr="&"... I
> > don't have to write attr="&amp;amp;" to get what I want. The same is true
> > with attr="&gt;"... it comes out as attr="&gt;" instead of attr=">". This
> is
> > all because DOMElementWriter.encode() is smart about those entities.
> >
> > attr="&#10;" should come out as attr="&#10;", 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 "&amp;" text, it sees whatever the XML parser
> reports, a "&", and the XML serializer Ant uses knows it must encode
> that char into "&amp;", 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
&#10;. I'd expect ant to give me &#10; 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

Reply via email to