Java 类org.jdom2.IllegalAddException 实例源码

项目:epubfx    文件:XHTMLUtils.java   
public static String repair(String originalHtml)
{
    String content = null;
    try
    {
        HtmlCleaner cleaner = createHtmlCleaner();

        //wir probieren es erstmal mit UTF-8
        TagNode rootNode = cleaner.clean(originalHtml);
        Document jdomDocument = new JDomSerializer(cleaner.getProperties(), false).createJDom(rootNode);
        jdomDocument.setDocType(Constants.DOCTYPE_XHTML.clone());

        XMLOutputter outputter = new XMLOutputter();
        Format xmlFormat = Format.getPrettyFormat();
        outputter.setFormat(xmlFormat);
        outputter.setXMLOutputProcessor(new XHTMLOutputProcessor());
        content = outputter.outputString(jdomDocument);
    }
    catch (IllegalAddException e)
    {
        logger.error("", e);
    }
    return content;
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * Pastes the bullet-point {@code clipbullet} into the xml-document. The
 * Element {@code clipbullet} must be retrieved by
 * {@link #copyBulletToClip(java.util.LinkedList) copyBulletToClip(java.util.LinkedList)}.
 *
 * @param timestamp the timestamp of the bullet that should be inserted
 * @param isRoot {@code true} when the drop-source is the root-element of
 * the jTree, {@code false} when the drop-source is any other parent-element
 */
public void pasteBulletFromClip(String timestamp, boolean isRoot) {
    // find the bulletgroup that is described in the treepath
    Element parentb = (isRoot) ? getCurrentDesktopElement() : findEntryElementFromTimestamp(getCurrentDesktopElement(), timestamp);
    // if we have a valid bullet-group, add the new bullet to the xml-file
    if (parentb != null && clipbullet != null) {
        // create a new element
        Element b = new Element(ELEMENT_BULLET);
        try {
            // set the name of the copied bullet-value
            b.setAttribute("name", clipbullet.getAttributeValue("name"));
            // and use copied timestamp
            b.setAttribute(ATTR_TIMESTAMP, clipbullet.getAttributeValue(ATTR_TIMESTAMP));
            // clone the content from the clipboard-bullet to the new element. we
            // have to clone the content, since the element "clipbullet" still might
            // be attached to the document, when the bullet is just copied, not cut.
            b.addContent(clipbullet.cloneContent());
            // add new bullet to the bulletgroup
            parentb.addContent(b);
            // change modified state
            setModified(true);
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method moves an element (entry-node or bullet-point) one position
 * up- or downwards, depending on the parameter {@code movement}.
 *
 * @param movement indicates whether the element should be moved up or down.
 * use following constants:<br> - {@code CConstants.MOVE_UP}<br> -
 * {@code CConstants.MOVE_DOWN}<br>
 * @param timestamp
 */
public void moveElement(int movement, String timestamp) {
    // get the selected element, independent from whether it's a node or a bullet
    Element e = findEntryElementFromTimestamp(getCurrentDesktopElement(), timestamp);
    if (e != null) {
        // get the element's parent
        Element p = e.getParentElement();
        // get the index of the element that should be moved
        int index = p.indexOf(e);
        // remove the element that should be moved
        Element dummy = (Element) p.removeContent(index);
        try {
            // and insert element one index-position below the previous index-position
            p.addContent((Constants.MOVE_UP == movement) ? index - 1 : index + 1, dummy);
            // change modifed state
            setModified(true);
        } catch (IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method initialises the desktopNotes-xml-file during an
 * update-process.<br><br>
 * This method is called when updating a file with version number 3.0 or 3.1
 * to 3.2 and higher.
 */
public void initDesktopNotesUpdate() {
    // iterate all desktops
    for (int cnt = 0; cnt < getCount(); cnt++) {
        // retrieve desktopname
        String dname = getDesktopName(cnt);
        // create new desktop-element
        Element desk = new Element("desktop");
        try {
            // set name attribute
            desk.setAttribute("name", dname);
            // add notes-sub-elements
            desk.addContent(new Element("notes1"));
            desk.addContent(new Element("notes2"));
            desk.addContent(new Element("notes3"));
            // add element to desktop-notes
            desktopNotes.getRootElement().addContent(desk);
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
        }
    }
}
项目:Zettelkasten    文件:Daten.java   
/**
 * This method sets the description of the zettelkasten-data, which is
 * stored in the metainformation-file of the zipped data-file.
 *
 * @param desc a string with the description of this zettelkasten
 * @return
 */
public boolean setZknDescription(String desc) {
    // get the element
    Element el = metainfFile.getRootElement().getChild(ELEMEMT_DESCRIPTION);
    try {
        // check whether element exists
        if (null == el) {
            // if element does not exist, create it
            el = new Element(ELEMEMT_DESCRIPTION);
            // and add it to the meta-xml-file
            metainfFile.getRootElement().addContent(el);
        }
        // finally, set the text
        el.setText(desc);
        // change modified state
        setMetaModified(true);
    } catch (IllegalAddException | IllegalDataException ex) {
        Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
        return false;
    }
    // return success
    return true;
}
项目:Zettelkasten    文件:StenoData.java   
/**
 * Adds a new pair of steno/long words to the document
 *
 * @param abbr the short, steno-abbreviation of the word
 * @param longword the long, original version of the word
 * @return {@code true} if element was successfully addes, false if {@code stenoword} already existed
 */
public boolean addElement(String abbr, String longword) {
    // check for existence
    if (exists(abbr)) {
        return false;
    }
    // if it doesn't already exist, create new element
    Element e = new Element(Daten.ELEMENT_ENTRY);
    try {
        // set id-attribute
        e.setAttribute("id", abbr);
        // set content
        e.setText(longword);
        // and add it to the document
        steno.getRootElement().addContent(e);
    }
    catch (IllegalAddException | IllegalDataException ex) {
        Constants.zknlogger.log(Level.SEVERE,ex.getLocalizedMessage());
        return false;
    }
    // return success
    return true;
}
项目:Zettelkasten    文件:Synonyms.java   
/**
 * This method adds a new synonym {@code appendsyn} to an existing synonym-line {@code nr}.
 *
 * @param nr the number of the existing synonym-line
 * @param appendsyn the new synonym that should be appended to that line.
 */
public void appendSingleSynonym(int nr, String appendsyn) {
    // get element
    Element synonym = retrieveElement(nr);
    // chekc for valid value
    if (synonym != null) {
        try {
            // create a sub-child "syn" for each further synonym
            Element syn = new Element("syn");
            // set text from string array
            syn.setText(appendsyn);
            // add child to synonym-element
            synonym.addContent(syn);
            setModified(true);
        } catch (IllegalAddException | IllegalDataException ex) {
            Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
        }
    }
}
项目:yawl    文件:EngineClient.java   
/**
 * Maps the values of the data attributes in the datalist of a
 * checked out workitem to the input params of the worklet case that will
 * run as a substitute for the checked out workitem.
 * The input params for the worklet case are required by the interface's
 * launchcase() method.
 *
 * @param wir the checked out work item
 * @return the loaded input params of the new worklet case
 *         (launchCase() requires the input params as a String)
 */
public String mapItemParamsToWorkletCaseParams(WorkItemRecord wir,
                                               Element itemData,
                                               YSpecificationID workletSpecID) {

    if (itemData == null) itemData = wir.getDataList();     // get datalist of work item
    Element wlData = new Element(workletSpecID.getUri());   // new datalist for worklet
    List<YParameter> inParams = getInputParams(workletSpecID);  // worklet input params

    // if worklet has no net-level inputs, or workitem has no datalist, we're done
    if ((inParams == null) || (itemData == null)) return null;

    // extract the name of each worklet input param
    for (YParameter param : inParams) {
        String paramName = param.getName();

        // get the data element of the workitem with the same name as
        // the one for the worklet (assigns null if no match)
        Element wlElem = itemData.getChild(paramName);

        try {
            // if matching element, copy it and add to worklet datalist
            if (wlElem != null) {
                Element copy = wlElem.clone();
                wlData.addContent(copy);
            }

            // no matching data for input param, so add empty element
            else
                wlData.addContent(new Element(paramName));
        } catch (IllegalAddException iae) {
            _log.error("Exception adding content to worklet data list", iae);
        }
    }

    // return the datalist as as string (as required by launchcase)
    return JDOMUtil.elementToString(wlData);
}
项目:epubfx    文件:XHTMLUtils.java   
public static Resource fromHtml(Resource res)
{
    try
    {
        String xhtml = fromHtml(res.getData());
        res.setData(xhtml.getBytes("UTF-8"));
        res.setInputEncoding("UTF-8");
    }
    catch (IOException | IllegalAddException e)
    {
        logger.error("", e);
    }

    return res;
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * Adds a new bullet-point to the xml-document.
 *
 * @param timestamp the timestamp of the currently selected bullet-point
 * after which the new bullet should be inserted.
 * @param name the name of the bullet-point
 * @return the timestamp of the added bullet-element as {@code String} or
 * {@code null} if an error occured.
 */
public String addBullet(String timestamp, String name) {
    // find the bulletgroup that is described in the treepath
    Element parentb = (timestamp != null) ? findEntryElementFromTimestamp(getCurrentDesktopElement(), timestamp) : getCurrentDesktopElement();
    String newts;
    // if we have a valid bullet-group, add the new bullet to the xml-file
    if (parentb != null) {
        // create a new element from the given name
        Element b = new Element(ELEMENT_BULLET);
        try {
            b.setAttribute("name", name);
            // set attribute for collapsed/expanded state of bullet
            b.setAttribute("treefold", TREE_FOLDING_EXPANDED);
            // create timestamp
            newts = Tools.getTimeStampWithMilliseconds();
            // check whether timestamp already exists. this is particulary the
            // case when a user adds several entries at once.
            while (timeStampExists(newts)) {
                newts = Tools.getTimeStampWithMilliseconds();
            }
            // set timestamp as attribute
            b.setAttribute(ATTR_TIMESTAMP, newts);
            // add a "comment" to that bullet. remember, that each bullet
            // automatically gets a child-element called "comment"
            b.addContent(new Element(ATTR_COMMENT));
            // add new bullet to the bulletgroup
            parentb.addContent(b);
            // change modified state
            setModified(true);
            // return timestamp of addes bullet
            return newts;
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
            return null;
        }
    }
    return null;
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method adds a new entry (child-node) to the xml-document.
 *
 * @param timestamp the timestamp of the element, where the entry "nr"
 * should be inserted as new child
 * @param nr the entry-number of the entry that should be added
 * @param insertpos the position where the new entry should be inserted.
 * necessary when we have already more children and the entry should be
 * inserted in between, at the beginning or end of the children-list.
 * @return the timestamp of the added entry-element as {@code String} or
 * {@code null} if an error occured.
 */
public String addEntry(String timestamp, String nr, int insertpos) {
    // find the bullet that is described in the treepath
    Element b = findEntryElementFromTimestamp(getCurrentDesktopElement(), timestamp);
    // if we have a valid bullet, add the new enry to the xml-file
    if (b != null) {
        // check whether element is a bullet, if not, retrieve its parent element
        if (!b.getName().equals(ELEMENT_BULLET)) {
            b = b.getParentElement();
        }
        // create a new element
        Element e = new Element(ELEMENT_ENTRY);
        try {
            e.setAttribute("id", nr);
            // create timestamp
            String ts = Tools.getTimeStampWithMilliseconds();
            // check whether timestamp already exists. this is particulary the
            // case when a user adds several entries at once.
            while (timeStampExists(ts)) {
                ts = Tools.getTimeStampWithMilliseconds();
            }
            // add timestamp to entry element
            e.setAttribute(ATTR_TIMESTAMP, ts);
            // add new enry to the bullet at insert-position+1 (because at first
            // position in the bullet is always the comment)
            b.addContent(insertpos, e);
            // change modified state
            setModified(true);
            // return timestamp
            return ts;
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
    return null;
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method adds a modified entry to the
 * {@link #modifiedEntries modifiedEntries}-Document, in case the user
 * modifies an entry on the desktop, while the original content of that
 * entry in the main database should be left unchanged.
 *
 * @param timestamp a unique timestamp which is associated to the entry that
 * is modified, so we can later easily find the related modified content.
 * @param content the modified content itself.
 * @return {@code true} if entry was successfully saved, {@code false} if an
 * error occured.
 */
public boolean addModifiedEntry(String timestamp, String content) {
    // check for valid parameters
    if (null == timestamp || timestamp.isEmpty()) {
        return false;
    }
    if (null == content) {
        content = "";
    }
    // first check, whether modified entry already exists. this may
    // occur, when importing archived desktop-files
    if (null == retrieveModifiedEntryElementFromTimestamp(timestamp)) {
        // create a new element
        Element entry = new Element(ELEMENT_ENTRY);
        try {
            // set timestamp-attribute
            entry.setAttribute(ATTR_TIMESTAMP, timestamp);
            // add content-string
            entry.setText(content);
            // add element to XML-document
            modifiedEntries.getRootElement().addContent(entry);
            // change modified-flag
            setModified(true);
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
            return false;
        }
    }
    return true;
}
项目:Zettelkasten    文件:Bookmarks.java   
/**
 * Adds a new bookmark to the bookmark-file. First, we have to check whether
 * the bookmark already exists. If not, add it. Then we have to check for
 * the category. If it already exists, retrieve the category's index-number.
 * Else add a new category.
 * <br><br>
 * Use "getCompleteBookmark" for retrieving a bookmark's entry-number,
 * category and comment.
 *
 * @param index the index-number of the bookmark, i.e. the entry's number
 * @param cat the category, under which the bookmark should appear.
 * @param comment an optional comment for the bookmark
 */
public void addBookmark(int index, String cat, String comment) {
    // first check whether this index-number was already bookmarked...
    // if not, a -1 is return, else the index-number
    // if the bookmark already exists, do nothing
    if (-1 == getBookmarkPosition(index)) {
        try {
            // retrieve the position of the category
            int catpos = getCategoryPosition(cat);
            // check whether the category exists
            if (-1 == catpos) {
                // if the category doesn't already exist, add it
                catpos = addCategory(cat);
            }
            // create new bookmark-element
            Element bm = new Element(Daten.ELEMENT_ENTRY);
            // set the id, i.e. the number of the entry which is bookmarked
            bm.setAttribute("id", String.valueOf(index));
            // set the category-index for this bookmark
            bm.setAttribute("cat", String.valueOf(catpos));
            // and add the comment
            if (null == comment) {
                comment = "";
            }
            bm.setText(comment);
            // retrieve the bookmark-"root"-element
            Element bookbase = bookmarks.getRootElement().getChild("bookmark");
            // and add the bookmark-element
            bookbase.addContent(bm);
            // change modified-state
            setModified(true);
        } catch (IllegalAddException | IllegalNameException | IllegalDataException ex) {
            Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
        }
    }
}
项目:Zettelkasten    文件:Daten.java   
/**
 * This method sets the links of an entry.
 *
 * @param pos the entry from which we want to set/change the hyperlinks and
 * attachments
 * @param attachments a string-array containing the hyperlinks,
 * attachmentspaths etc.
 */
public void setAttachments(int pos, String[] attachments) {
    // retrieve the entry
    Element entry = retrieveElement(zknFile, pos);
    // if no element exists, return empty array
    if (null == entry || null == attachments || attachments.length < 1) {
        return;
    }
    // remove all existing links from that entry
    entry.getChild(ELEMENT_ATTACHMENTS).removeChildren(ELEMENT_ATTCHILD);
    // save modification-stata
    boolean mod = false;
    // add each hyperlink string
    // therefor, iterate the array
    for (String a : attachments) {
        try {
            // create a new subchuld-element
            Element sublink = new Element(ELEMENT_ATTCHILD);
            // add the link-string from the array
            sublink.setText(a);
            // and add sublink-element to entry's child's content
            entry.getChild(ELEMENT_ATTACHMENTS).addContent(sublink);
            // change modification state
            mod = true;
        } catch (IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
    // change modified state
    if (mod) {
        setModified(true);
    }
}
项目:Zettelkasten    文件:Daten.java   
/**
 * This method add the links to an entry.
 *
 * @param pos the entry from which we want to set/change the hyperlinks and
 * attachments
 * @param attachments a string-array containing the hyperlinks,
 * attachmentspaths etc.
 */
public void addAttachments(int pos, String[] attachments) {
    // retrieve the entry
    Element entry = retrieveElement(zknFile, pos);
    // if no element exists, return empty array
    if (null == entry || null == attachments || attachments.length < 1) {
        return;
    }
    // save modification-stata
    boolean mod = false;
    // add each hyperlink string
    // therefor, iterate the array
    for (String a : attachments) {
        try {
            // create a new subchuld-element
            Element sublink = new Element(ELEMENT_ATTCHILD);
            // add the link-string from the array
            sublink.setText(a);
            // and add sublink-element to entry's child's content
            entry.getChild(ELEMENT_ATTACHMENTS).addContent(sublink);
            // change modification state
            mod = true;
        } catch (IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
    // change modified state
    if (mod) {
        setModified(true);
    }
}
项目:Zettelkasten    文件:Synonyms.java   
public void addSynonym(String[] synline) {
    // we need at least two elements in the array: the original word and at least one synonym
    if (null == synline || synline.length < 2) {
        return;
    }
    // if the synonyms-index-word already exists, don't add it...
    if (getSynonymPosition(synline[0]) != -1) {
        return;
    }
    // create new synonyms element
    Element synonym = new Element(Daten.ELEMENT_ENTRY);
    try {
        // trim spaces
        synline[0] = synline[0].trim();
        // set the original word as value-attribute to the "entry"-element
        synonym.setAttribute("indexword", synline[0]);
        // now go through the rest of the string-array
        for (int cnt = 1; cnt < synline.length; cnt++) {
            // create a sub-child "syn" for each further synonym
            Element syn = new Element("syn");
            // set text from string array
            syn.setText(synline[cnt].trim());
            // add child to synonym-element
            synonym.addContent(syn);
        }
        // finally, add new element to the document
        synonymsFile.getRootElement().addContent(synonym);
        setModified(true);
    } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
        Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
    }
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method adds a new desktop-element to the document. Furthermore,
 * currentDesktop-number is set to the latest added desktop-index-number.
 *
 * @param name the name of the desktop, which appears in the desktopDialog's
 * combobox
 * @param notes the initial desktop-notes that should be associated with
 * this desktop. use this e.g. when importing an archived desktop (see
 * {@link #importArchivedDesktop(org.jdom.Document) importArchivedDesktop()}.
 * use {@code null} when no notes-content should be added (i.e. the elements
 * are being created, but they have no text).
 * @return {@code true} if the desktop was successfully added, {@code false}
 * otherwise (e.g. because the desktop-name already existed)
 */
public boolean addNewDesktop(String name, String[] notes) {
    // first of all, go through all desktops and check whether the name
    // already exist, to avoid double naming...
    // when such a desktopname as "name" already exists, return false
    for (int cnt = 0; cnt < getCount(); cnt++) {
        if (name.equalsIgnoreCase(getDesktopName(cnt))) {
            return false;
        }
    }
    // create new element
    Element d = new Element("desktop");
    try {
        // set the desktop's name as attribute
        d.setAttribute("name", name);
        // add the element to the desktop
        desktop.getRootElement().addContent(d);
        // set currentDesktop index to the new desktop-element
        currentDesktop = desktop.getRootElement().getContentSize() - 1;
        // also add new desktop-notes-element
        Element desk = new Element("desktop");
        // set name attribute
        desk.setAttribute("name", name);
        // create notes elements
        Element n1 = new Element("notes1");
        Element n2 = new Element("notes2");
        Element n3 = new Element("notes3");
        // set initial notes text, if we have any...
        if (notes != null && notes.length > 0) {
            // check for array-length before setting text
            if (notes.length > 0) {
                n1.setText(notes[0]);
            }
            // check for array-length before setting text
            if (notes.length > 1) {
                n2.setText(notes[1]);
            }
            // check for array-length before setting text
            if (notes.length > 2) {
                n3.setText(notes[2]);
            }
        }
        // add notes-sub-elements
        desk.addContent(n1);
        desk.addContent(n2);
        desk.addContent(n3);
        // add element to desktop-notes
        desktopNotes.getRootElement().addContent(desk);
        // change modified state
        setModified(true);
    } catch (IllegalAddException | IllegalNameException | IllegalDataException ex) {
        Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
        return false;
    }
    return true;
}
项目:Zettelkasten    文件:DesktopData.java   
/**
 * This method archives the desktop-data of the desktop with the name
 * {@code name} to a zipped xml-file. The file contains the desktop-data,
 * the modifed-entries-data for those entries that appear on the desktop and
 * the saved desktop-notes.
 *
 * @param name the name of the desktop that should be archived.
 * @return the archived document as XML-focument, or {@code null} if an
 * error occured.
 */
public Document archiveDesktop(String name) {
    // create new document
    Document archive = new Document(new Element("archivedDesktop"));
    // add desktop-element of desktop that should be archived
    Element deskel = getDesktopElement(name);
    // if we found a valid value, go on
    if (deskel != null) {
        try {
            // set name attribute
            archive.getRootElement().setAttribute("name", name);
            // create desktop-element
            Element content_desktop = new Element("desktop");
            // clone content from current desktop
            content_desktop.addContent(deskel.cloneContent());
            // add element to archive-file
            archive.getRootElement().addContent(content_desktop);
            // now retrieve desktop-notes
            Element noteel = getDesktopNotes(name);
            // if we found a valid value, go on
            if (noteel != null) {
                // create notes-element
                Element content_notes = new Element("desktopNotes");
                // clone content from current desktop-notes
                content_notes.addContent(noteel.cloneContent());
                // add content
                archive.getRootElement().addContent(content_notes);
            }
            // now retrieve all timestamps from the archived desktop
            // and look for modified entries...
            // create new list that will contain the timestamps
            timestampList = new ArrayList<>();
            // fill list with all entry-numbers. since we have sub-bullets/levels, we
            // recursevly go through the desktop-data
            retrieveDesktopEntriesTimestamps(deskel);
            // if we have any results, go on...
            if (timestampList.size() > 0) {
                // create base element
                Element modifiedel = new Element("modifiedEntries");
                // add all modified entries that appear on the archived desktop
                String[] timestamps = timestampList.toArray(new String[timestampList.size()]);
                for (String ts : timestamps) {
                    // retrieve modifed entry
                    Element me_dummy = retrieveModifiedEntryElementFromTimestamp(ts);
                    // check for valid value
                    if (me_dummy != null) {
                        // crate new modified-entry-element
                        Element me = new Element(ELEMENT_ENTRY);
                        // set timestamp-attribute
                        me.setAttribute(ATTR_TIMESTAMP, ts);
                        // and add modified text
                        me.setText(me_dummy.getText());
                        // and add content
                        modifiedel.addContent(me);
                    }
                }
                archive.getRootElement().addContent(modifiedel);
            }
        } catch (IllegalNameException | IllegalDataException | IllegalAddException ex) {
            Constants.zknlogger.log(Level.SEVERE, ex.getLocalizedMessage());
            return null;
        }
    }
    return archive;
}