public void pushCDATA(char delimiter) throws IOException {
        charArray.empty();
        next();//skip [ or -
        int sb = 0;//number of delimiter one after the other
        while (sb != 2 || c != '>') {
            if (c == delimiter) {
                if (sb == 2) //case with ]]] or ---
                    charArray.append(delimiter);//push delimiter back ] or -
                else
                    sb++;
            } else {
                if (sb != 0) { //case with ]c or -c
                    charArray.append(delimiter); //write back delimiter ] or -
                    if (sb == 2) { //case with ]]c or --c
                        charArray.append(delimiter); //write back another delimter ]] or --
                    }
                    sb = 0;
                }
                charArray.append(c);
            }
            next();
        }
    }