当前位置: 首页>>代码示例>>Java>>正文


Java Element.addContent方法代码示例

本文整理汇总了Java中org.jdom2.Element.addContent方法的典型用法代码示例。如果您正苦于以下问题:Java Element.addContent方法的具体用法?Java Element.addContent怎么用?Java Element.addContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdom2.Element的用法示例。


在下文中一共展示了Element.addContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMetadataFormats

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * for the server request ?verb=ListMetadataFormats this method build the xml section
 * 
 * @return
 */
public Element createMetadataFormats() {
    Namespace xmlns = DataManager.getInstance().getConfiguration().getStandardNameSpace();
    if (Metadata.values().length == 0) {
        return new ErrorCode().getNoMetadataFormats();
    }
    Element listMetadataFormats = new Element("ListMetadataFormats", xmlns);
    for (Metadata m : Metadata.values()) {
        // logger.trace("{}: {}", m.getMetadataPrefix(), DataManager.getInstance().getConfiguration().isMetadataFormatEnabled(m.name()));
        if (m.isOaiSet() && DataManager.getInstance().getConfiguration().isMetadataFormatEnabled(m.name())) {
            Element metadataFormat = new Element("metadataFormat", xmlns);
            Element metadataPrefix = new Element("metadataPrefix", xmlns);
            metadataPrefix.setText(m.getMetadataPrefix());
            Element schema = new Element("schema", xmlns);
            schema.setText(m.getSchema());
            Element metadataNamespace = new Element("metadataNamespace", xmlns);
            metadataNamespace.setText(m.getMetadataNamespace());
            metadataFormat.addContent(metadataPrefix);
            metadataFormat.addContent(schema);
            metadataFormat.addContent(metadataNamespace);
            listMetadataFormats.addContent(metadataFormat);
        }
    }
    return listMetadataFormats;
}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:30,代码来源:XMLGeneration.java

示例2: prepareDocumentationElement

import org.jdom2.Element; //导入方法依赖的package包/类
private Element prepareDocumentationElement(Namespace rootns) {
	Element documentationOf = new Element("documentationOf", rootns);
	Element serviceEvent = new Element("serviceEvent", rootns);
	Element performer = new Element("performer", rootns);
	Element assignedEntity = new Element("assignedEntity", rootns);
	Element nationalProviderIdentifier = new Element("id", rootns)
			.setAttribute("root", "2.16.840.1.113883.4.6")
			.setAttribute("extension", "2567891421");

	Element representedOrganization = prepareRepOrgWithTaxPayerId(rootns);
	assignedEntity.addContent(representedOrganization);
	assignedEntity.addContent(nationalProviderIdentifier);
	performer.addContent(assignedEntity);
	serviceEvent.addContent(performer);
	documentationOf.addContent(serviceEvent);
	return documentationOf;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:18,代码来源:ClinicalDocumentDecoderTest.java

示例3: testInternalDecode

import org.jdom2.Element; //导入方法依赖的package包/类
@Test
void testInternalDecode() throws Exception {
    Namespace rootNs = Namespace.getNamespace("urn:hl7-org:v3");
    Namespace ns = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");

    Context context = new Context();
    Element element = new Element("observation", rootNs);
    element.addContent(new Element("templateId", rootNs).setAttribute("root", TemplateId.ACI_AGGREGATE_COUNT.getTemplateId(context)));
    element.addContent(new Element("value", rootNs).setAttribute("value", "450").setAttribute("type", "INT", ns));
    element.addNamespaceDeclaration(ns);

    Node thisNode = new Node();

    AggregateCountDecoder instance = new AggregateCountDecoder(context);
    instance.setNamespace(element, instance);

    instance.internalDecode(element, thisNode);

    assertThat(thisNode.getValue("aggregateCount"))
            .isEqualTo("450");
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:22,代码来源:AggregateCountDecoderTest.java

示例4: addJSONToElement

import org.jdom2.Element; //导入方法依赖的package包/类
private void addJSONToElement(Hashtable<String, Institution> institutions, Element parent) {
	JSONObject geoJSON = new JSONObject();
	JSONArray allGeoJSON = new JSONArray();
	if (institutions.size() > 0) {
	Iterator<Entry<String, Institution>> institutionIterator = institutions.entrySet().iterator();
	while (institutionIterator.hasNext()) {
		Institution institution = institutionIterator.next().getValue();
		try {
		if (institution.getLatitude() == 0) {
			InstitutionBuilder.addMercatorCorrdinates(institution);
			InstitutionBuilder.saveEnrichedScopusExport(institution);
		}
		allGeoJSON.put(institution.createGeoJsonPoint());
		} catch (Exception e) {
			LOGGER.info("could not set geo data");
		}
	}
	}
	geoJSON.put("features", allGeoJSON);
	geoJSON.put("type", "FeatureCollection");
	parent.addContent(geoJSON.toString());
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:23,代码来源:AffiliationsStatistics.java

示例5: createListIdentifiers

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * for the server request ?verb=ListIdentifiers this method build the xml section
 * 
 * @param handler
 * @param firstRow
 * @param numRows
 * @return
 * @throws SolrServerException
 */
public Element createListIdentifiers(RequestHandler handler, int firstRow, int numRows) throws SolrServerException {
    Map<String, String> datestamp = filterDatestampFromRequest(handler);
    SolrDocumentList listIdentifiers = solr.getListIdentifiers(datestamp, firstRow, numRows, false);
    if (listIdentifiers == null || listIdentifiers.isEmpty()) {
        return new ErrorCode().getNoRecordsMatch();
    }

    Namespace xmlns = DataManager.getInstance().getConfiguration().getStandardNameSpace();
    Element xmlListIdentifiers = new Element("ListIdentifiers", xmlns);
    long totalHits = listIdentifiers.getNumFound();
    for (int i = 0; i < listIdentifiers.size(); i++) {
        SolrDocument doc = listIdentifiers.get(i);
        Element header = getHeader(doc, null, handler);
        xmlListIdentifiers.addContent(header);
    }

    // Create resumption token
    if (totalHits > firstRow + numRows) {
        Element resumption = createResumptionTokenAndElement(totalHits, firstRow + numRows, xmlns, handler);
        xmlListIdentifiers.addContent(resumption);
    }

    return xmlListIdentifiers;
}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:34,代码来源:XMLGeneration.java

示例6: generateEpicurHeader

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * generates header for epicur format
 * 
 * @param doc
 * @param dateUpdated
 * @return
 */
private static Element generateEpicurHeader(SolrDocument doc, long dateUpdated) {
    Namespace xmlns = DataManager.getInstance().getConfiguration().getStandardNameSpace();
    Element header = new Element("header", xmlns);
    Element identifier = new Element("identifier", xmlns);
    identifier.setText(DataManager.getInstance().getConfiguration().getOaiIdentifier().get("repositoryIdentifier") + (String) doc.getFieldValue(
            "URN"));
    header.addContent(identifier);

    Element datestamp = new Element("datestamp", xmlns);
    datestamp.setText(parseDate(dateUpdated));
    header.addContent(datestamp);
    // setSpec
    List<String> setSpecFields = DataManager.getInstance().getConfiguration().getSetSpecFieldsForMetadataFormat(Metadata.epicur.name());
    if (!setSpecFields.isEmpty()) {
        for (String setSpecField : setSpecFields) {
            if (doc.containsKey(setSpecField)) {
                for (Object fieldValue : doc.getFieldValues(setSpecField)) {
                    // TODO translation
                    Element setSpec = new Element("setSpec", xmlns);
                    setSpec.setText((String) fieldValue);
                    header.addContent(setSpec);
                }
            }
        }
    }
    // status="deleted"
    if (doc.getFieldValues(SolrConstants.DATEDELETED) != null) {
        header.setAttribute("status", "deleted");
    }

    return header;
}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:40,代码来源:XMLGeneration.java

示例7: prepareOutput

import org.jdom2.Element; //导入方法依赖的package包/类
/**
    * Prepares the basic output with a given root element name and the friendly name and the current timestamp
    * 
    * 
    * @param job
    *            <code>MCRServletJob</code>
    * @param outputName the name of the root element for the output
    * @return an org.jdom2.element acting as root element for the output
    */
   public static Element prepareOutput(MCRServletJob job, String outputName) {
    Element output = new Element(outputName);
    Element navbar = new Element("navbar");
    org.apache.shiro.subject.Subject currentUser = SecurityUtils.getSubject();
    String username = (String) job.getRequest().getSession().getAttribute("username");
    navbar.addContent(new Element("loggedInAs").setText(username));
    navbar.addContent(new Element("qualifiedAs").setText("analyst"));
       if (currentUser.hasRole("userAdmin"))
           navbar.addContent(new Element("admin").setText("true"));
       navbar.addContent(new Element("now").setText(String.valueOf(System.currentTimeMillis())));
       output.addContent(navbar);
    return output;
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:23,代码来源:BibliometricsServlet.java

示例8: prepareInfoRecipient

import org.jdom2.Element; //导入方法依赖的package包/类
private Element prepareInfoRecipient(Namespace rootns, String programName) {
	Element informationRecipient = new Element("informationRecipient", rootns);
	Element intendedRecipient = new Element("intendedRecipient", rootns);
	Element programNameEl = new Element("id", rootns)
			.setAttribute("root", "2.16.840.1.113883.3.249.7")
			.setAttribute("extension", programName);
	intendedRecipient.addContent(programNameEl);
	informationRecipient.addContent(intendedRecipient);
	return informationRecipient;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:11,代码来源:ClinicalDocumentDecoderTest.java

示例9: prepareParticipant

import org.jdom2.Element; //导入方法依赖的package包/类
private Element prepareParticipant(Namespace rootns) {
	Element participant = new Element("participant", rootns);
	Element associatedEntity = new Element("associatedEntity", rootns);

	Element entityId = new Element("id", rootns)
		.setAttribute("root", "2.16.840.1.113883.3.249.5.1")
		.setAttribute("extension", ENTITY_ID_VALUE)
		.setAttribute("assigningAuthorityName", "CMS-CMMI");
	Element addr = new Element("addr", rootns)
		.setText("testing123");
	associatedEntity.addContent(entityId);
	associatedEntity.addContent(addr);
	participant.addContent(associatedEntity);
	return participant;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:16,代码来源:ClinicalDocumentDecoderTest.java

示例10: sendEmail

import org.jdom2.Element; //导入方法依赖的package包/类
private void sendEmail(String link) {
    Element mail = new Element("email");

    Element sender = new Element("from");
    sender.addContent("[email protected]");
    mail.addContent(sender);

    Element recipients = new Element("to");
    String to = "[email protected]";
    recipients.addContent(to);
    mail.addContent(recipients);
    //Element blindCarbonCopy = new Element("bcc");
    //blindCarbonCopy.addContent();
    //mail.addContent(blindCarbonCopy);

    Element subject = new Element("subject");
    subject.addContent("Bibliometrischer Report bereit");
    mail.addContent(subject);

    Element body = new Element("body");

    String mailContents = "Der Report kann unter folgender Adresse heruntergeladen werden: " + link + " \n";
    mailContents = mailContents + "und hier angesehen werden: " + link.replace("download", "display") +  " \n";

    String greeting = "\n" + "Vielen herzlichen Dank.\n" + "Ihre AG Forschung & Innovation";

    mailContents = mailContents + greeting;
    body.addContent(mailContents);
    mail.addContent(body);
    MCRMailer.send(mail);
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:32,代码来源:BibliometricReportExportServlet.java

示例11: prepareComponentElement

import org.jdom2.Element; //导入方法依赖的package包/类
private Element prepareComponentElement(Namespace rootns) {
	Element component = new Element("component", rootns);
	Element structuredBody = new Element("structuredBody", rootns);
	Element componentTwo = new Element("component", rootns);
	Element aciSectionElement = new Element("templateId", rootns);
	aciSectionElement.setAttribute("root", TemplateId.ACI_SECTION.getRoot());
	aciSectionElement.setAttribute("extension", TemplateId.ACI_SECTION.getExtension());

	componentTwo.addContent(aciSectionElement);
	structuredBody.addContent(componentTwo);
	component.addContent(structuredBody);
	return component;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:14,代码来源:ClinicalDocumentDecoderTest.java

示例12: wrongSchema

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * @param response
 * @param string
 * @throws IOException
 */
private static void wrongSchema(HttpServletResponse response, String parameter) throws IOException {
    Element searchRetrieveResponse = new Element("searchRetrieveResponse", SRU_NAMESPACE);
    Element version = new Element("version", SRU_NAMESPACE);
    version.setText("1.2");
    searchRetrieveResponse.addContent(version);
    Element diagnostic = new Element("diagnostic", SRU_NAMESPACE);
    searchRetrieveResponse.addContent(diagnostic);

    Element uri = new Element("uri", DIAG_NAMESPACE);
    uri.setText("info:srw/diagnostic/1/66");
    diagnostic.addContent(uri);

    Element details = new Element("details", DIAG_NAMESPACE);
    details.setText("   Unknown schema for retrieval");
    diagnostic.addContent(details);

    Element message = new Element("message", DIAG_NAMESPACE);

    message.setText("Unknown schema for retrieval / " + parameter);
    diagnostic.addContent(message);
    Document doc = new Document();
    doc.setRootElement(searchRetrieveResponse);
    Format format = Format.getPrettyFormat();
    format.setEncoding("utf-8");
    XMLOutputter xmlOut = new XMLOutputter(format);
    xmlOut.output(doc, response.getOutputStream());

}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:34,代码来源:SruServlet.java

示例13: preparePublicationList

import org.jdom2.Element; //导入方法依赖的package包/类
public Element preparePublicationList() {
	Element pubList = new Element("mods:collection");
	for (Element mods : modsList) {
		if (mods.getChild("mods:extension") != null)
			mods.removeChild("mods:extension");
		pubList.addContent(mods);
	}
	return pubList;
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:10,代码来源:GeneralStatistics.java

示例14: generateEchoedSearchRetrieveRequest

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * @param root
 * @param solrDocuments
 * @param parameter
 */
private static void generateEchoedSearchRetrieveRequest(Element root, List<SolrDocument> solrDocuments, SruRequestParameter parameter) {
    Element echoedSearchRetrieveRequest = new Element("echoedSearchRetrieveRequest", SRU_NAMESPACE);
    root.addContent(echoedSearchRetrieveRequest);

    Element version = new Element("version", SRU_NAMESPACE);
    version.setText(parameter.getVersion());
    echoedSearchRetrieveRequest.addContent(version);

    Element recordSchema = new Element("recordSchema", SRU_NAMESPACE);
    recordSchema.setText(parameter.getRecordSchema().getMetadataPrefix());
    echoedSearchRetrieveRequest.addContent(recordSchema);

    Element query = new Element("query", SRU_NAMESPACE);
    query.setText(parameter.getQuery());
    echoedSearchRetrieveRequest.addContent(query);

    Element recordPacking = new Element("recordPacking", SRU_NAMESPACE);
    recordPacking.setText(parameter.getRecordPacking());
    echoedSearchRetrieveRequest.addContent(recordPacking);

    Element startRecord = new Element("startRecord", SRU_NAMESPACE);
    startRecord.setText(String.valueOf(parameter.getStartRecord()));
    echoedSearchRetrieveRequest.addContent(startRecord);

    Element maximumRecords = new Element("maximumRecords", SRU_NAMESPACE);
    maximumRecords.setText(String.valueOf(parameter.getMaximumRecords()));
    echoedSearchRetrieveRequest.addContent(maximumRecords);

}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:35,代码来源:SruServlet.java

示例15: addToOutput

import org.jdom2.Element; //导入方法依赖的package包/类
public void addToOutput(Element output) {
	Element institutionElement = new Element("institution");
	institutionElement.addContent(new Element("description").setText(institution));
	institutionElement.addContent(new Element("location").setText(city));
	institutionElement.addContent(new Element("country").setText(country));
	institutionElement.addContent(new Element("latitude").setText(String.valueOf(latitude)));
	institutionElement.addContent(new Element("longitude").setText(String.valueOf(longitude)));
	output.addContent(institution);
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:10,代码来源:Institution.java


注:本文中的org.jdom2.Element.addContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。