ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <latch...@gmail.com>
Subject Re: bug in DOMElementWriter
Date Sat, 26 Jun 2010 16:44:20 GMT
Here is a better example:

<?xml version="1.0"?>
<project name="test" basedir=".">
<echoxml>
 <test attr="&#10;" />
</echoxml>
</project>

[8][ //tmp ]% ant
Buildfile: build.xml
<?xml version="1.0" encoding="UTF-8"?>
<test attr="
" />

BUILD SUCCESSFUL
Total time: 0 seconds

Not what I was expecting.

jon


On Fri, Jun 25, 2010 at 5:02 PM, Jon Stevens <latchkey@gmail.com> wrote:

> Say you have an element like this:
>
> <foo attr="&#10;" />
>
> If you want to load that through an XMLFragment and then output it later,
> the DOMElementWriter.encode() method doesn't case properly for non-printable
> characters.
>
> The quick fix for me in this case was to overload that method and add this:
>
>                 case '\n':
>                     sb.append("&#10;");
>                     break;
>
> Obviously, you'd want a more complete encoding of all possible values.
>
> jon
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message