/** * JDOM will throw an exception if we try and add the content to multiple parents. * As a result, we take the opportunity to add it safely, and add a note indicating * this content appears twice. * * @param cell the element to be added * @param xmlContent the collector of content */ private void addContentSafely(final Element cell, final List<Content> xmlContent) { Element note = null; for (Content c : xmlContent) { if (c.getParent() == null) { cell.addContent(c); } else if (note != null) { note.addContent(c.clone()); } else { //we're in the situation where we have added this already. //add note. In this case, we wrap the content that has already been applied. note = appendVersificationNotice(cell, "duplicate"); note.addContent(c.clone()); } } }
Element notice = this.appendVersificationNotice(cell, "omitted-verses"); notice.addContent(text); } else {