public void buildXmlDocument() throws Exception {
        System.out.println(entryList);
        System.out.println(file);
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.newDocument();
        Element root = (Element) doc.createElement("journal");
        doc.appendChild(root);

        for (ScriptureReference entry : entryList) {
            Element jEntry = doc.createElement("entry"); //makes and element
            root.appendChild(jEntry);                    //attaches it to the root

            // set attribute to entry element
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Attr attr = doc.createAttribute("date");
            attr.setValue(sdf.format(entry.getEntryDate().getTime()));
            jEntry.setAttributeNode(attr);

            for (Scripture s : entry.getScriptures()) {
                // create scripter elements
                Element script = doc.createElement("scripture");
                jEntry.appendChild(script);

                attr = doc.createAttribute("book");
                attr.setValue(s.getBook());
                script.setAttributeNode(attr);

                attr = doc.createAttribute("chapter");
                attr.setValue(Integer.toString(s.getChapter()));
                script.setAttributeNode(attr);

                attr = doc.createAttribute("startverse");
                attr.setValue(Integer.toString(s.getStartVerse()));
                script.setAttributeNode(attr);

                attr = doc.createAttribute("endverse");
                attr.setValue(Integer.toString(s.getEndVerse()));
                script.setAttributeNode(attr);
            }

            for (String t : entry.getTopics()) {
                // create topic elements
                Element topic = doc.createElement("topic");
                topic.appendChild(doc.createTextNode(t));
                jEntry.appendChild(topic);
            }

            // add the content to the file
            Element content = doc.createElement("content");
            content.appendChild(doc.createTextNode(entry.getContent()));
            jEntry.appendChild(content);
        }
        saveDocument(doc);
    }