@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        Element element = HtmlFactory.getElement(localName);

        if (isWithinElement) {
            isWithinElement = false;
            BufferedWriter writer = null;
            try {
                writer = new BufferedWriter(new FileWriter("./output1.txt", true));
                writer.newLine();
                writer.flush();
                writer.close();

            } catch (IOException ex) {
                Logger.getLogger(HtmlContentHandlerLankaDeepa.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        if (element == Element.A || element == Element.AREA || element == Element.LINK) {
            anchorFlag = false;

        }
        // comment for commit 2013.04.26
        if (element == Element.BODY) {
            isWithinBodyElement = false;
            if (isDatabasesendOK) {
                SQLCommunicator.InsertInToTable(table,new String[]{databaseAuthor.toString(), databaseDate.toString(), databaseTopic.toString(), databaseContent.toString()});
            }
        }

    }