public static String getTag(BufferedReader reader, String line, String tag) throws TheAppException {
        line = line.substring(line.indexOf(tag));
        StringBuilder builder = new StringBuilder();
        while (line != null && (line.indexOf(">")) == -1) {
            builder.append(line);
            line = getLine(reader);
        }

        if (line != null) {
            builder.append(line);
        }

        String midTag = builder.toString();
        String firstPart = midTag.substring(0, midTag.indexOf(">") + 1);
        String secondPart = midTag.substring(firstPart.length());
        StringBuilder secondBuilder = new StringBuilder();
        if (firstPart.contains("/>")) {
            return firstPart;
        } else {
            while (secondPart != null && !secondPart.contains(tag.substring(1) + ">")) {
                secondBuilder.append(secondPart);
                secondPart = getLine(reader);
            }

            if (secondPart != null) {
                secondBuilder.append(secondPart);
            }

            String secondString = secondBuilder.toString();
            return firstPart + secondString.substring(0, secondString.indexOf(tag.substring(1) + ">") + 1);
        }

    }