Say you have an element like this: <foo attr=" " />
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(" "); break; Obviously, you'd want a more complete encoding of all possible values. jon