private void addLines(Document doc, Element linesElement, FileData fileData) {
        int maxLines = fileData.getLines().size();
        if (fileData.getBranchData().size() > 0)
            maxLines = Math.max(fileData.getLines().size(), Collections.max(fileData.getBranchData().keySet())+1);
        for (int i = 0; i < maxLines; i++) {
            Element lineElement = null;
            //Add line element
            lineElement = addLineElement(doc, linesElement, fileData, i, lineElement);
            //Add branch element
            addBranchElement(doc, linesElement, fileData, i, lineElement);
        }
    }