Search in sources :

Example 36 with Content

use of org.jdom2.Content in project mycore by MyCoRe-Org.

the class MCRDerivate method createXML.

/**
 * This methode create a XML stream for all object data.
 *
 * @exception MCRException
 *                if the content of this class is not valid
 * @return a JDOM Document with the XML data of the object as byte array
 */
@Override
public final org.jdom2.Document createXML() throws MCRException {
    Document doc = super.createXML();
    Element elm = doc.getRootElement();
    elm.addContent(mcr_derivate.createXML());
    elm.addContent(mcr_service.createXML());
    return doc;
}
Also used : Element(org.jdom2.Element) Document(org.jdom2.Document)

Example 37 with Content

use of org.jdom2.Content in project mycore by MyCoRe-Org.

the class MCRMetaBoolean method createXML.

/**
 * This method create a XML stream for all data in this class, defined by
 * the MyCoRe XML MCRBoolean definition for the given subtag.
 *
 * @exception MCRException
 *                if the content of this class is not valid
 * @return a JDOM Element with the XML MCRBoolean part
 */
@Override
public Element createXML() throws MCRException {
    Element elm = super.createXML();
    elm.addContent(getValueToString());
    return elm;
}
Also used : Element(org.jdom2.Element)

Example 38 with Content

use of org.jdom2.Content in project mycore by MyCoRe-Org.

the class MCRMetaClassification method createXML.

/**
 * This method create a XML stream for all data in this class, defined by
 * the MyCoRe XML MCRMetaClassification definition for the given subtag.
 *
 * @exception MCRException
 *                if the content of this class is not valid
 * @return a JDOM Element with the XML MCRClassification part
 */
@Override
public Element createXML() throws MCRException {
    Element elm = super.createXML();
    elm.setAttribute("classid", getClassId());
    elm.setAttribute("categid", getCategId());
    return elm;
}
Also used : Element(org.jdom2.Element)

Example 39 with Content

use of org.jdom2.Content in project mycore by MyCoRe-Org.

the class MCRMetaDefault method createXML.

/**
 * This abstract method create a XML stream for all data in this class,
 * defined by the MyCoRe XML MCRMeta... definition for the given subtag.
 *
 * @exception MCRException
 *                if the content of this class is not valid
 * @return a JDOM Element with the XML MCRMeta... part
 */
public Element createXML() throws MCRException {
    try {
        validate();
    } catch (MCRException exc) {
        debug();
        throw exc;
    }
    Element elm = new Element(subtag);
    if (getLang() != null && getLang().length() > 0)
        elm.setAttribute("lang", getLang(), Namespace.XML_NAMESPACE);
    if (getType() != null && getType().length() > 0) {
        elm.setAttribute("type", getType());
    }
    elm.setAttribute("inherited", Integer.toString(getInherited()));
    return elm;
}
Also used : MCRException(org.mycore.common.MCRException) Element(org.jdom2.Element)

Example 40 with Content

use of org.jdom2.Content in project mycore by MyCoRe-Org.

the class MCRMetaHistoryDate method createXML.

/**
 * This method creates a XML stream for all data in this class, defined by
 * the MyCoRe XML MCRMetaHistoryDate definition for the given subtag.
 *
 * @exception MCRException
 *                if the content of this class is not valid
 * @return a JDOM Element with the XML MCRMetaHistoryDate part
 */
@Override
public org.jdom2.Element createXML() throws MCRException {
    Element elm = super.createXML();
    for (MCRMetaHistoryDateText text : texts) {
        Element elmt = new Element("text");
        elmt.addContent(text.getText());
        elmt.setAttribute("lang", text.getLang(), Namespace.XML_NAMESPACE);
        elm.addContent(elmt);
    }
    elm.addContent(new org.jdom2.Element("calendar").addContent(calendar));
    elm.addContent(new org.jdom2.Element("ivon").addContent(Integer.toString(ivon)));
    elm.addContent(new org.jdom2.Element("von").addContent(getVonToString()));
    elm.addContent(new org.jdom2.Element("ibis").addContent(Integer.toString(ibis)));
    elm.addContent(new org.jdom2.Element("bis").addContent(getBisToString()));
    return elm;
}
Also used : Element(org.jdom2.Element)

Aggregations

Element (org.jdom2.Element)77 Document (org.jdom2.Document)27 IOException (java.io.IOException)18 JDOMException (org.jdom2.JDOMException)16 File (java.io.File)11 MCRException (org.mycore.common.MCRException)11 Content (org.jdom2.Content)10 MCRContent (org.mycore.common.content.MCRContent)10 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)10 XMLOutputter (org.jdom2.output.XMLOutputter)9 SAXBuilder (org.jdom2.input.SAXBuilder)8 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 Attribute (org.jdom2.Attribute)6 MCRPath (org.mycore.datamodel.niofs.MCRPath)6 SAXException (org.xml.sax.SAXException)6 JsonElement (com.google.gson.JsonElement)5 Color (java.awt.Color)4 MCRDerivate (org.mycore.datamodel.metadata.MCRDerivate)4 MCRObject (org.mycore.datamodel.metadata.MCRObject)4