Example usage for org.jdom2 Element setText

List of usage examples for org.jdom2 Element setText

Introduction

In this page you can find the example usage for org.jdom2 Element setText.

Prototype

public Element setText(final String text) 

Source Link

Document

Sets the content of the element to be the text given.

Usage

From source file:es.upm.dit.xsdinferencer.generation.generatorimpl.statisticsgeneration.StatisticResultsDocGeneratorImpl.java

License:Apache License

/**
 * This method generates an element which contains the representation of a basic statistics entry. Depending on which basic statistics entry is going to 
 * be represented, the element could have a different name, different identifying attributes(like path, name, namespace, value...).
 * @param elementName the name of the generated element
 * @param path the path where the entry comes from (if it comes from a path), if it is not null, a 'path' attribute is generated with this value, else, no 'path' attribute is generated.
 * @param name the name of the source node (if it comes from a complex type statistics entry), if it is not null, a 'name' attribute is generated with this value, else, no 'name' attribute is generated.
 * @param namespace the namespace of the source node (if it comes from a complex type statistics entry), if it is not null, a 'namespace' attribute is generated with this value, else, no 'namespace' attribute is generated.
 * @param value the value which the entry is related to (if it is related to a value), if it is not null, a 'value' child element with this value is generated (and xml:space attribute set to 'preserve'), else, no 'value' element is generated.
 * @param entry the entry to represent//  w  ww .j av a2 s  . co  m
 * @param generateConditionedStatistics flag to indicate whether conditioned statistics info should be generated and attached to the element
 * @param generateNonZeroRatio flag to indicate whether non zero ratio info should be generated and attached to the element
 * @return the representation of the BasicStatisticsEntry object, as a JDOM2 element
 */
protected Element generateBasicStatisticsEntryBasedElement(String elementName, String path, String name,
        String namespace, String value, BasicStatisticsEntry entry, boolean generateConditionedStatistics,
        boolean generateNonZeroRatio) {
    Element generatedElement = new Element(elementName, STATISTICS_NAMESPACE);
    if (path != null) {
        Attribute pathAttr = new Attribute("path", path);
        generatedElement.setAttribute(pathAttr);
    }
    if (value != null) {
        Element valueElement = new Element("value", STATISTICS_NAMESPACE);
        valueElement.setText(value);
        Attribute spaceAttribute = new Attribute("space", "preserve", Namespace.XML_NAMESPACE);
        valueElement.setAttribute(spaceAttribute);
        generatedElement.addContent(valueElement);

    }

    if (name != null) {
        Attribute nameAttr = new Attribute("name", name);
        generatedElement.setAttribute(nameAttr);
    }

    if (namespace != null) {
        Attribute namespaceAttr = new Attribute("namespace", namespace);
        generatedElement.setAttribute(namespaceAttr);
    }

    //      Element averageElement = new Element("average", STATISTICS_NAMESPACE);
    //      averageElement.setText(entry.getAverage()+"");
    //      atPathElement.addContent(averageElement);

    Attribute averageAttribute = new Attribute("average", roundingFormat.format(entry.getAverage()) + "");
    generatedElement.setAttribute(averageAttribute);

    Set<ValueAndFrequency> mode = entry.getMode();

    if (!mode.isEmpty()) {
        Element modeElement = new Element("modes", STATISTICS_NAMESPACE);
        for (ValueAndFrequency modeValue : mode) {
            Element valueElement = new Element("modeValue", STATISTICS_NAMESPACE);
            valueElement.setText(roundingFormat.format(modeValue.getValue()) + "");
            Attribute valueFreqAttr = new Attribute("frequency", modeValue.getFrequency() + "");
            valueElement.setAttribute(valueFreqAttr);
            modeElement.addContent(valueElement);
        }
        generatedElement.addContent(modeElement);
    }

    //      Element maxElement=new Element("max",STATISTICS_NAMESPACE);
    //      ValueAndFrequency max = entry.getMax();
    //      maxElement.setText(max.getValue()+"");
    //      Attribute maxFreqAttr = new Attribute("frequency", max.getFrequency()+"");
    //      maxElement.setAttribute(maxFreqAttr);
    //      generatedElement.addContent(maxElement);

    Attribute maxAttribute = new Attribute("max", roundingFormat.format(entry.getMax().getValue()) + "");
    generatedElement.setAttribute(maxAttribute);

    Attribute maxFrequencyAttribute = new Attribute("frequencyOfMax", entry.getMax().getFrequency() + "");
    generatedElement.setAttribute(maxFrequencyAttribute);

    //      Element minElement=new Element("min",STATISTICS_NAMESPACE);
    //      ValueAndFrequency min = entry.getMin();
    //      minElement.setText(min.getValue()+"");
    //      Attribute minFreqAttr = new Attribute("frequency", min.getFrequency()+"");
    //      minElement.setAttribute(minFreqAttr);
    //      generatedElement.addContent(minElement);

    Attribute minAttribute = new Attribute("min", roundingFormat.format(entry.getMin().getValue()) + "");
    generatedElement.setAttribute(minAttribute);

    Attribute minFrequencyAttribute = new Attribute("frequencyOfMin", entry.getMin().getFrequency() + "");
    generatedElement.setAttribute(minFrequencyAttribute);

    //      Element varianceElement = new Element("variance", STATISTICS_NAMESPACE);
    //      varianceElement.setText(entry.getVariance()+"");
    //      generatedElement.addContent(varianceElement);

    Attribute varianceAttribute = new Attribute("variance", roundingFormat.format(entry.getVariance()) + "");
    generatedElement.setAttribute(varianceAttribute);

    //      Element standardDeviationAverageRatioElement = new Element("standardDeviationAverageRatio", STATISTICS_NAMESPACE);
    //      standardDeviationAverageRatioElement.setText(entry.getStandardDeviationAverageRatio()+"");
    //      generatedElement.addContent(standardDeviationAverageRatioElement);

    Attribute standardDeviationAverageRatioAttribute = new Attribute("standardDeviationAverageRatio",
            roundingFormat.format(entry.getStandardDeviationAverageRatio()) + "");
    generatedElement.setAttribute(standardDeviationAverageRatioAttribute);

    if (generateConditionedStatistics) {

        Attribute conditionedAverageAttribute = new Attribute("conditionedAverage",
                roundingFormat.format(entry.getConditionedAverage()) + "");
        generatedElement.setAttribute(conditionedAverageAttribute);

        Attribute conditionedVarianceAttribute = new Attribute("conditionedVariance",
                roundingFormat.format(entry.getConditionedVariance()) + "");
        generatedElement.setAttribute(conditionedVarianceAttribute);

        Attribute conditionedStandardDeviationAverageRatioAttribute = new Attribute(
                "conditionedStandardDeviationAverageRatio",
                roundingFormat.format(entry.getConditionedStandardDeviationAverageRatio()) + "");
        generatedElement.setAttribute(conditionedStandardDeviationAverageRatioAttribute);

        //         Element conditionedStandardDeviationAverageRatioElement = new Element("conditionedStandardDeviationAverageRatio", STATISTICS_NAMESPACE);
        //         conditionedStandardDeviationAverageRatioElement.setText(entry.getConditionedStandardDeviationAverageRatio()+"");
        //         generatedElement.addContent(conditionedStandardDeviationAverageRatioElement);
        //         
        //         Element conditionedAverageElement = new Element("conditionedAverage", STATISTICS_NAMESPACE);
        //         conditionedAverageElement.setText(entry.getConditionedAverage()+"");
        //         generatedElement.addContent(conditionedAverageElement);
        //         
        //         Element conditionedVarianceElement = new Element("conditionedVariance", STATISTICS_NAMESPACE);
        //         conditionedVarianceElement.setText(entry.getConditionedVariance()+"");
        //         generatedElement.addContent(conditionedVarianceElement);

    }

    if (generateNonZeroRatio) {
        Attribute nonZeroRatioAttribute = new Attribute("presenceRatio",
                roundingFormat.format(entry.getNonZeroRatio()) + "");
        generatedElement.setAttribute(nonZeroRatioAttribute);

        //         Element nonZeroRatio = new Element("presenceRatio", STATISTICS_NAMESPACE);
        //         nonZeroRatio.setText(""+entry.getNonZeroRatio());
        //         generatedElement.addContent(nonZeroRatio);
    }

    //      Element totalElement = new Element("total", STATISTICS_NAMESPACE);
    //      totalElement.setText(entry.getTotal()+"");
    //      generatedElement.addContent(totalElement);

    Attribute totalAttribute = new Attribute("total", roundingFormat.format(entry.getTotal()) + "");
    generatedElement.setAttribute(totalAttribute);

    return generatedElement;
}

From source file:es.upm.dit.xsdinferencer.generation.generatorimpl.statisticsgeneration.StatisticResultsDocGeneratorImpl.java

License:Apache License

/**
 * This method generates an element with the info of subpatterns.
 * @param elementName the element name/*from  w ww  .  jav  a2  s . c  o m*/
 * @param subpatternsInfo the info of subpatterns
 * @return An element with all the information described
 */
protected Element generateSubpatternsInfoElement(String elementName,
        Map<List<SchemaElement>, Integer> subpatternsInfo) {
    Element element = new Element(elementName, STATISTICS_NAMESPACE);
    for (List<SchemaElement> subpattern : subpatternsInfo.keySet()) {
        int occurrences = subpatternsInfo.get(subpattern);
        Element occurrencesElement = new Element("occurrences", STATISTICS_NAMESPACE);
        occurrencesElement.setText("" + occurrences);
        element.addContent(occurrencesElement);
        Element subpatternElementsElement = new Element("subpatternElements", STATISTICS_NAMESPACE);
        for (int i = 0; i < subpattern.size(); i++) {
            SchemaElement schemaElement = subpattern.get(i);
            Element subpatternElementElement = new Element("subpatternElement", STATISTICS_NAMESPACE);
            subpatternElementElement.setAttribute("name", schemaElement.getName());
            subpatternElementElement.setAttribute("namespace", schemaElement.getNamespace());
            subpatternElementsElement.addContent(subpatternElementElement);
        }
        element.addContent(subpatternElementsElement);
    }
    return element;
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Makes the token./*from w  ww .j a v  a2  s. co m*/
 * @param ocrWord
 * @return the related element.
 */
private Element makeOcrWordEl(OcrWord ocrWord) {
    Element ocrWordEl = new Element("span", xmlns);
    String wordId = ocrWord.getId();
    ocrWordEl.setAttribute("id", wordId);
    ocrWordEl.setAttribute("class", "ocr_word");
    ocrWordEl.setAttribute("title", ocrWord.getScan().getCoords().getBbox());
    Element alternativeEl = new Element("span", xmlns);
    alternativeEl.setAttribute("class", "alternatives");
    Element alternativeInsertionEl = new Element("ins", xmlns);
    alternativeInsertionEl.setAttribute("class", "alt");
    alternativeInsertionEl.setAttribute("title", ocrWord.getInsertion().getNlp());
    alternativeInsertionEl.setText(ocrWord.getInsertion().getText());
    alternativeEl.addContent(alternativeInsertionEl);
    for (Deletion alternativeDeletion : ocrWord.getDeletions()) {
        alternativeEl.addContent(makeAlternativeDeletionEl(alternativeDeletion));
    }
    ocrWordEl.addContent(alternativeEl);
    return ocrWordEl;
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Makes the alternative deletion.//  www  .j  a  va 2  s  .c  o  m
 * @param alternativeDeletion
 * @return an alternative deletion.
 */
private Element makeAlternativeDeletionEl(Deletion alternativeDeletion) {
    Element alternativeDeletionEl = new Element("del", xmlns);
    //alternativeDeletionEl.setAttribute("class", "alt");
    alternativeDeletionEl.setAttribute("title", alternativeDeletion.getNlp());
    alternativeDeletionEl.setText(alternativeDeletion.getText());
    return alternativeDeletionEl;
}

From source file:eu.himeros.hocr.GrcContextFilterMananger.java

License:Open Source License

@Override
public void adjustPreviousSuitableElement() {
    Element prevEl = queue.poll();
    Element currEl = queue.peek();
    Element nextEl = queue.get(1);
    try {//from w  w  w. j a va  2s  .c o  m
        Element prevInfo = prevEl.getChild("span", prevEl.getNamespace());
        Element currInfo = currEl.getChild("span", currEl.getNamespace());
        Element nextInfo = nextEl.getChild("span", nextEl.getNamespace());
        if (currInfo != null && "UCWORD".equals(currInfo.getAttributeValue("class"))) {
            String suggestions = "";
            try {
                suggestions = filterSuggestions(currInfo.getText(), prevInfo.getText(), nextInfo.getText(),
                        currInfo.getAttributeValue("title"));
            } catch (NullPointerException npex) {
                //
            }
            if (suggestions.trim().contains(" ")) {
                currInfo.setAttribute("title", suggestions);
            } else if (suggestions.length() > 0) {
                currInfo.setAttribute("class", "CORRWORD");
                currInfo.setAttribute("title", currInfo.getText());
                currInfo.setText(suggestions);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
}

From source file:eu.himeros.hocr.HocrInfoAggregator.java

License:Open Source License

private void parseOcrWord(Element ocrWord) {
    String text = ocrWord.getText();
    text = adjuster.adjust(new String[] { "monotonic2polytonic", "ocr2u" }, normalizer2.normalize(text));
    String upText = low2upL1Trans.parse(text);
    if (text.endsWith("-")) {
        ocrWord.setAttribute("idx", "" + id++);
        hyphenPart1 = ocrWord;//from   ww w .  j a  va2 s  . c o m
        return;
    } else if (hyphenPart1 != null) {
        text = adjuster.adjust(new String[] { "monotonic2polytonic", "ocr2u" },
                normalizer2.normalize(parseOcrHyphenatedWord(hyphenPart1, ocrWord)));
        upText = low2upL1Trans.parse(text);
    }
    Element infoSpan = new Element("span", xmlns);
    infoSpan.setText(adjuster.adjust(new String[] { "monotonic2polytonic", "ocr2u" },
            normalizer2.normalize(ocrWord.getText())));
    upText = upText.replaceAll(l1NonAlphabeticFilter, "");
    infoSpan.setAttribute("id", "" + id++);
    Integer occ;
    occ = ((occ = occHm.get(upText)) == null ? 1 : ++occ);
    occHm.put(upText, occ);
    infoSpan.setAttribute("uc", upText);
    try {
        ocrWord.getContent(0).detach();
    } catch (Exception ex) {
    }
    Token token = new Token(text);
    token = setClassiFicationAndScore(token);
    infoSpan = setInfoSpanClass(token, infoSpan);
    ocrWord.addContent(infoSpan);
    l1Fm.addSuitableElement(ocrWord);
    l1Fm.adjustPreviousSuitableElement();
    if (hyphenPart1 != null) {
        text = hyphenPart1.getText();
        hyphenPart1.getContent(0).detach();
        Element infoSpan1 = new Element("span", xmlns);
        infoSpan1.setAttribute("class", infoSpan.getAttributeValue("class"));
        infoSpan1.setText(text);
        hyphenPart1.addContent(infoSpan1);
        hyphenPart1 = null; //TODO: ???
    }
}

From source file:eu.himeros.hocr.HocrInfoAggregator.java

License:Open Source License

private void makeCompliantHocr() {
    xpath = XPathFactory.instance().compile("//ns:span[@id|@idx]", Filters.element(), null,
            Namespace.getNamespace("ns", "http://www.w3.org/1999/xhtml"));
    List<Element> elements = xpath.evaluate(root);
    int spanId = 0;
    for (Element span : elements) {
        if (span.getAttribute("idx") != null) {
            try {
                span = span.getChildren().get(0);
            } catch (Exception ex) {
                //
            }//from   w  ww . j  a va 2s . c  o  m
        }
        LinkedList<Attribute> attributeLl = new LinkedList(span.getParentElement().getAttributes());
        attributeLl.addFirst(new Attribute("id", "w_" + spanId++));
        span.getParentElement().setAttributes(attributeLl);
        String[] suggestions = null;
        String title = span.getAttributeValue("title");
        if (title != null) {
            suggestions = title.split(" ");
        }
        if (suggestions == null) {
            suggestions = new String[] { "" };
        }
        Element ins = new Element("ins", xmlns);
        ins.setAttribute("class", "alt");
        ins.setAttribute("title", makeNlp(span.getAttributeValue("class")));
        ins.setText(span.getText());
        span.removeContent();
        span.addContent(ins);
        span.setAttribute("class", "alternatives");
        span.removeAttribute("uc");
        span.removeAttribute("occ");
        span.removeAttribute("title");
        span.removeAttribute("anchor");
        span.removeAttribute("anchor-id");
        span.removeAttribute("id");
        span.getParentElement().removeAttribute("idx");
        span.removeAttribute("whole");
        span.getParentElement().removeAttribute("whole");
        if (title == null || "".equals(title)) {
            continue;
        }
        double score = 0.90;
        for (String suggestion : suggestions) {
            if (suggestion == null || "".equals(suggestion)) {
                continue;
            }
            Element del = new Element("del", xmlns);
            del.setAttribute("title", "nlp " + String.format("%.2f", score).replaceAll(",", "."));
            score = score - 0.01;
            suggestion = suggestion.replaceAll(l1PunctMarkFilter, "");
            Matcher leftMatcher = l1LeftPunctMarkPattern.matcher(ins.getText());
            if (leftMatcher.matches()) {
                suggestion = leftMatcher.group(1) + suggestion;
            }
            Matcher rightMatcher = l1RightPunctMarkPattern.matcher(ins.getText());
            if (rightMatcher.matches()) {
                String ngtSymbol = "";
                if (suggestion.endsWith("\u261a")) {
                    ngtSymbol = "\u261a";
                    suggestion = suggestion.substring(0, suggestion.length() - 1);
                }
                suggestion = suggestion + rightMatcher.group(1) + ngtSymbol;
            }
            ///!!!!
            if (suggestion.endsWith("\u261a") && ins.getParentElement().getParentElement()
                    .getAttributeValue("lang", Namespace.XML_NAMESPACE) != null) {
                String buff = suggestion.substring(0, suggestion.length() - 1);
                sa.align(buff, ins.getText());
                double sim = 1 - sa.getEditDistance()
                        / Math.max((double) buff.length(), (double) ins.getText().length());
                if (sim > 0.6) {

                    suggestion = ins.getText() + "\u261b";
                    ins.setText(buff);
                    ins.setAttribute("title", "nlp 0.70");
                }
            }
            del.addContent(suggestion);
            span.addContent(del);
        }
    }
}

From source file:eus.ixa.ixa.pipe.convert.AbsaSemEval.java

License:Apache License

public static String nafToAbsa2015(String inputNAF) throws IOException {

    Path kafPath = Paths.get(inputNAF);
    KAFDocument kaf = KAFDocument.createFromFile(kafPath.toFile());
    Set<String> reviewIds = getReviewIdsFromXpathAttribute(kaf);

    // root element in ABSA 2015 and 2016 format
    Element reviewsElem = new Element("Reviews");
    Document doc = new Document(reviewsElem);

    // creating Reviews children of Review
    for (String reviewId : reviewIds) {
        Element reviewElem = new Element("Review");
        reviewElem.setAttribute("rid", reviewId);
        Element sentencesElem = new Element("sentences");
        // getting the sentences in the review
        List<List<WF>> sentencesByReview = getSentencesByReview(kaf, reviewId);
        for (List<WF> sent : sentencesByReview) {
            String sentId = sent.get(0).getXpath();
            Integer sentNumber = sent.get(0).getSent();

            // getting text element from word forms in NAF
            String textString = NAFUtils.getSentenceStringFromWFs(sent);
            Element sentenceElem = new Element("sentence");
            sentenceElem.setAttribute("id", sentId);
            Element textElem = new Element("text");
            textElem.setText(textString);
            sentenceElem.addContent(textElem);

            // creating opinions element for sentence
            List<Opinion> opinionsBySentence = getOpinionsBySentence(kaf, sentNumber);
            Element opinionsElem = new Element("Opinions");
            if (!opinionsBySentence.isEmpty()) {
                // getting opinion info from NAF Opinion layer
                for (Opinion opinion : opinionsBySentence) {
                    Element opinionElem = new Element("Opinion");
                    // String polarity = opinion.getOpinionExpression().getPolarity();
                    String category = opinion.getOpinionExpression().getSentimentProductFeature();
                    String targetString = opinion.getStr();
                    int fromOffset = opinion.getOpinionTarget().getTerms().get(0).getWFs().get(0).getOffset();
                    List<WF> targetWFs = opinion.getOpinionTarget().getTerms()
                            .get(opinion.getOpinionTarget().getTerms().size() - 1).getWFs();
                    int toOffset = targetWFs.get(targetWFs.size() - 1).getOffset()
                            + targetWFs.get(targetWFs.size() - 1).getLength();
                    opinionElem.setAttribute("target", targetString);
                    opinionElem.setAttribute("category", category);
                    // TODO we still do not have polarity here
                    opinionElem.setAttribute("polarity", "na");
                    opinionElem.setAttribute("from", Integer.toString(fromOffset));
                    opinionElem.setAttribute("to", Integer.toString(toOffset));
                    opinionsElem.addContent(opinionElem);
                }/*from  ww w.  j  a  v a 2 s .co  m*/
            }
            sentenceElem.addContent(opinionsElem);
            sentencesElem.addContent(sentenceElem);
        }
        reviewElem.addContent(sentencesElem);
        reviewsElem.addContent(reviewElem);
    } // end of review

    XMLOutputter xmlOutput = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    xmlOutput.setFormat(format);
    return xmlOutput.outputString(doc);
}

From source file:eus.ixa.ixa.pipe.convert.AbsaSemEval.java

License:Apache License

public static String nafToAbsa2014(String kafDocument) {

    KAFDocument kaf = null;/* w  ww  .  j  a v  a2  s.  c  o m*/
    try {
        Path kafPath = Paths.get(kafDocument);
        kaf = KAFDocument.createFromFile(kafPath.toFile());
    } catch (IOException e) {
        e.printStackTrace();
    }
    Element sentencesElem = new Element("sentences");
    Document doc = new Document(sentencesElem);

    for (List<WF> sent : kaf.getSentences()) {
        String sentId = sent.get(0).getXpath();
        Integer sentNumber = sent.get(0).getSent();

        // getting text element from WFs in NAF
        String textString = NAFUtils.getSentenceStringFromWFs(sent);
        Element sentenceElem = new Element("sentence");
        sentenceElem.setAttribute("id", sentId);
        Element textElem = new Element("text");
        textElem.setText(textString);
        sentenceElem.addContent(textElem);

        // creating opinions element for sentence
        List<Opinion> opinionsBySentence = getOpinionsBySentence(kaf, sentNumber);
        if (!opinionsBySentence.isEmpty()) {
            Element aspectTerms = new Element("aspectTerms");
            // getting opinion info from NAF Opinion layer
            for (Opinion opinion : opinionsBySentence) {
                String polarity = "";
                String targetString = opinion.getStr();
                int fromOffset = opinion.getOpinionTarget().getTerms().get(0).getWFs().get(0).getOffset();
                List<WF> targetWFs = opinion.getOpinionTarget().getTerms()
                        .get(opinion.getOpinionTarget().getTerms().size() - 1).getWFs();
                int toOffset = targetWFs.get(targetWFs.size() - 1).getOffset()
                        + targetWFs.get(targetWFs.size() - 1).getLength();

                Element aspectTerm = new Element("aspectTerm");
                aspectTerm.setAttribute("term", targetString);
                aspectTerm.setAttribute("polarity", polarity);
                aspectTerm.setAttribute("from", Integer.toString(fromOffset));
                aspectTerm.setAttribute("to", Integer.toString(toOffset));
                aspectTerms.addContent(aspectTerm);
            }
            sentenceElem.addContent(aspectTerms);
        }
        sentencesElem.addContent(sentenceElem);
    }
    XMLOutputter xmlOutput = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    xmlOutput.setFormat(format);
    return xmlOutput.outputString(doc);
}

From source file:firstPackage.WorkWithFile.java

/**
 *
 *///w ww .  j ava2 s  . c o  m
public void saveAppointmentsInFile() {

    try {
        Element root = new Element("appointments");
        Document doc = new Document(root);

        for (Map.Entry<String, Appointment> me : wwhm.mapOfAppointments.entrySet()) {
            Element node = new Element("apointment-data");
            root.addContent(node);
            Element name = new Element("Name");
            name.setText(me.getValue().getNameOfAppointment());
            node.addContent(name);
            Element description = new Element("Description");
            description.setText(me.getValue().getDescription());
            node.addContent(description);
            Element dateOfEditing = new Element("DateOfEditing");
            dateOfEditing.setText(me.getValue().getDateOfEditing());
            node.addContent(dateOfEditing);
            Element typeOfAppointment = new Element("DypeOfAppointment");
            typeOfAppointment.setText(me.getValue().getTypeOfAppointment().toString());
            node.addContent(typeOfAppointment);
        }

        XMLout.output(doc, fw);
    } catch (IOException ex) {
        Logger.getLogger(WorkWithFile.class.getName()).log(Level.SEVERE, null, ex);
    }
}