void skipUntil(String delim) throws java.lang.Exception {
        while (!tryRead(delim)) {
            char c;

            // As long as there's nothing in the
            // read buffer, try reading more data
            // (for an external entity) or popping
            // the entity stack (for either).
            while (readBufferPos >= readBufferLength) {
                switch (sourceType) {
                case INPUT_READER:
                case INPUT_EXTERNAL:
                case INPUT_STREAM:
                    readDataChunk();

                    while (readBufferLength < 1) {
                        popInput();

                        if (readBufferLength < 1) {
                            readDataChunk();
                        }
                    }

                    break;

                default:
                    popInput();
                    break;
                }
            }

            c = readBuffer[readBufferPos++];

            if (c == '\n') {
                line++;
                column = 0;
            } else {
                column++;
            }
        }
    }