private static void encode( String value, Appendable out ) throws IOException{
        for( int i = 0, n = value.length(); i<n; i++ ){
            char c = value.charAt( i );
            switch( c ){
                case '<':
                    out.append( "&lt;" );
                    break;
                case '>':
                    out.append( "&gt;" );
                    break;
                case '\'':
                    out.append( "&apos;" );
                    break;
                case '"':
                    out.append( "&quot;" );
                    break;
                case '&':
                    out.append( "&amp;" );
                    break;
                default:
                    out.append( c );
                    break;
            }
        }
    }