private boolean createDom(Section odMLRoot, boolean asTerminology) {
        logger.debug("in createDom\twith RootSection");
        doc = new Document();
        // create processing instruction the last one added is the preferred one
        ProcessingInstruction instr = null;
        ProcessingInstruction altInstr = null;
        if (asTerminology) {
            altInstr = new ProcessingInstruction("xml-stylesheet",
                    "type=\"text/xsl\" href=\"odml.xsl\"");
            instr = new ProcessingInstruction("xml-stylesheet",
                    "type=\"text/xsl\" href=\"odmlTerms.xsl\"");

        } else {
            altInstr = new ProcessingInstruction("xml-stylesheet",
                    "type=\"text/xsl\" href=\"odmlTerms.xsl\"");
            instr = new ProcessingInstruction("xml-stylesheet",
                    "type=\"text/xsl\" href=\"odml.xsl\"");
        }
        doc.addContent(instr);
        doc.addContent(altInstr);
        Element rootElement = new Element("odML");
        rootElement.setAttribute("version", "1");
        doc.setRootElement(rootElement);
        // if the odMLRoot has properties, a dummy root is added to ensure that everything is written
        Section dummyRoot;
        if (odMLRoot.propertyCount() != 0) {
            dummyRoot = new Section();
            dummyRoot.add(odMLRoot);
            dummyRoot.setDocumentAuthor(odMLRoot.getDocumentAuthor());
            dummyRoot.setDocumentDate(odMLRoot.getDocumentDate());
            dummyRoot.setDocumentVersion(odMLRoot.getDocumentVersion());
            dummyRoot.setRepository(odMLRoot.getRepository());
        } else {
            dummyRoot = odMLRoot;
        }
        String author = dummyRoot.getDocumentAuthor();
        if (author != null) {
            Element authorElement = new Element("author");
            authorElement.setText(author);
            rootElement.addContent(authorElement);
        }
        String version = dummyRoot.getDocumentVersion();
        if (version != null) {
            Element versionElement = new Element("version");
            versionElement.setText(version);
            rootElement.addContent(versionElement);
        }
        String dateString = null;
        Date date = dummyRoot.getDocumentDate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (date != null) {
            dateString = sdf.format(date);
        } else {
            date = new Date(Calendar.getInstance().getTimeInMillis());
            dateString = sdf.format(date);
        }
        if (dateString != null) {
            Element dateElement = new Element("date");
            dateElement.setText(dateString);
            rootElement.addContent(dateElement);
        }
        URL repository = dummyRoot.getRepository();
        if (repository != null) {
            Element repElement = new Element("repository");
            repElement.setText(repository.toString());
            rootElement.addContent(repElement);
        }
        for (int i = 0; i < dummyRoot.sectionCount(); i++) {
            appendSection(rootElement, dummyRoot.getSection(i), asTerminology);
        }

        return true;
    }