本文整理了Java中org.jdom.Element.setContent()
方法的一些代码示例,展示了Element.setContent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setContent()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:setContent
[英]Replace the child at the given index whith the supplied collection.
In event of an exception the original content will be unchanged and the content in the supplied collection will be unaltered.
[中]将给定索引处的子项替换为提供的集合。
如果出现异常,原始内容将保持不变,所提供集合中的内容将保持不变。
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Element setContent(Collection newContent)
{
return element.setContent(newContent);
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Element setContent(int index, Content child)
{
return element.setContent(index, child);
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Element setContent(Content child)
{
return element.setContent(child);
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Parent setContent(int index, Collection collection)
{
return element.setContent(index, collection);
}
代码示例来源:origin: geosolutions-it/geoserver-manager
protected void add(final String nodename, final Content nodetext) {
final Element el=new Element(nodename);
el.setContent(nodetext);
this.addContent(el);
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
protected Element createInstructions() {
Element instructions = new Element("instructions");
instructions.setContent(new CDATA(getInstruction()));
return instructions;
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
protected Element createInstructions(StructuredArtifactHomeInterface home) {
Element instructions = new Element("instructions");
instructions.setContent(new CDATA(home.getInstruction()));
return instructions;
}
代码示例来源:origin: com.atlassian.theplugin/atlassian-plugin-commons
public static Document prepareCloseReviewSummaryNode(String message) {
Element root = new Element("closeReviewSummary");
Document doc = new Document(root);
if (message != null) {
Element messageData = new Element("summary");
getContent(root).add(messageData);
CDATA patchT = new CDATA(message);
messageData.setContent(patchT);
}
return doc;
}
代码示例来源:origin: com.atlassian.theplugin/atlassian-plugin-commons
public static Document prepareAddPatchNode(String repoName, String patch) {
Element root = new Element("addPatch");
Document doc = new Document(root);
addTag(root, "repository", repoName);
if (patch != null) {
Element patchData = new Element("patch");
getContent(root).add(patchData);
CDATA patchT = new CDATA(patch);
patchData.setContent(patchT);
}
return doc;
}
代码示例来源:origin: com.atlassian.theplugin/atlassian-plugin-commons
public static Document prepareCreateReviewNode(Review review, String patch) {
Element root = new Element("createReview");
Document doc = new Document(root);
getContent(root).add(prepareReviewNodeElement(review));
if (patch != null) {
Element patchData = new Element("patch");
getContent(root).add(patchData);
CDATA patchT = new CDATA(patch);
patchData.setContent(patchT);
}
return doc;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-tools
private Element dumpContext(Context context) {
Element e = new Element(E_CONTEXT);
if (context.getType() != null) {
Element ee = new Element(E_TYPE);
ee.setContent(new Text(context.getType()));
e.addContent(ee);
}
if (context.getCollection() != null) {
Element ee = new Element(E_COLLECTION);
ee.setContent(new Text(context.getCollection()));
e.addContent(ee);
}
if (context.getKeywords() != null)
for (String keyword : context.getKeywords()) {
Element ee = new Element(E_KEYWORD);
ee.setContent(new Text(keyword));
e.addContent(ee);
}
return e;
}
代码示例来源:origin: pl.edu.icm.synat/synat-content-impl
private Element dumpContext(Context context) {
Element e = new Element(E_CONTEXT);
if (context.getType() != null) {
Element ee = new Element(E_TYPE);
ee.setContent(new Text(context.getType()));
e.addContent(ee);
}
if (context.getCollection() != null) {
Element ee = new Element(E_COLLECTION);
ee.setContent(new Text(context.getCollection()));
e.addContent(ee);
}
if (context.getKeywords() != null) {
for (String keyword : context.getKeywords()) {
Element ee = new Element(E_KEYWORD);
ee.setContent(new Text(keyword));
e.addContent(ee);
}
}
return e;
}
代码示例来源:origin: geosolutions-it/geoserver-manager
protected void set(final String nodename, final Content nodeContent) {
final Element el=ElementUtils.contains(getRoot(),nodename);
if (el==null){
add(nodename,nodeContent);
}
else {
el.setContent(nodeContent);
}
}
代码示例来源:origin: com.google.code.jetm/jetm-reporting-utilities
nameElement.setContent(new CDATA(aggregate.getName()));
element.addContent(nameElement);
代码示例来源:origin: org.codehaus.enunciate/enunciate-docs
protected void generateExampleXml(Value value, org.jdom.Element parent) {
DocumentationExample exampleInfo = value.getAnnotation(DocumentationExample.class);
if (exampleInfo == null || !exampleInfo.exclude()) {
parent.setContent(new Text(exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value()));
}
}
代码示例来源:origin: bcdev/beam
private static Element createFilterBandElement(String filterType) {
final Element bandInfo = new Element(DimapProductConstants.TAG_SPECTRAL_BAND_INFO);
final Element filterInfo = new Element(DimapProductConstants.TAG_FILTER_BAND_INFO);
final Attribute bandType = new Attribute(DimapProductConstants.ATTRIB_BAND_TYPE, filterType);
filterInfo.setAttribute(bandType);
bandInfo.setContent(filterInfo);
return bandInfo;
}
代码示例来源:origin: bcdev/beam
public void testCanDecode_NoBandType() {
final Element bandInfo = new Element(DimapProductConstants.TAG_SPECTRAL_BAND_INFO);
final Element filterInfo = new Element(DimapProductConstants.TAG_FILTER_BAND_INFO);
bandInfo.setContent(filterInfo);
assertFalse(_persistableSpi.canDecode(bandInfo));
}
代码示例来源:origin: bcdev/beam
@Override
public Element createXmlFromObject(Object object) {
final ConvolutionFilterBand cfb = (ConvolutionFilterBand) object;
final List<Element> contentList = new ArrayList<>();
contentList.add(createElement(DimapProductConstants.TAG_BAND_INDEX, String.valueOf(cfb.getProduct().getBandIndex(cfb.getName()))));
contentList.add(createElement(DimapProductConstants.TAG_BAND_NAME, cfb.getName()));
contentList.add(createElement(DimapProductConstants.TAG_BAND_DESCRIPTION, cfb.getDescription()));
contentList.add(createElement(DimapProductConstants.TAG_DATA_TYPE, ProductData.getTypeString(cfb.getDataType())));
contentList.add(createElement(DimapProductConstants.TAG_PHYSICAL_UNIT, cfb.getUnit()));
contentList.add(createElement(DimapProductConstants.TAG_SOLAR_FLUX, String.valueOf(cfb.getSolarFlux())));
contentList.add(createElement(DimapProductConstants.TAG_BAND_WAVELEN, String.valueOf(cfb.getSpectralWavelength())));
contentList.add(createElement(DimapProductConstants.TAG_BANDWIDTH, String.valueOf(cfb.getSpectralBandwidth())));
contentList.add(createElement(DimapProductConstants.TAG_SCALING_FACTOR, String.valueOf(cfb.getScalingFactor())));
contentList.add(createElement(DimapProductConstants.TAG_SCALING_OFFSET, String.valueOf(cfb.getScalingOffset())));
contentList.add(createElement(DimapProductConstants.TAG_SCALING_LOG_10, String.valueOf(cfb.isLog10Scaled())));
contentList.add(createElement(DimapProductConstants.TAG_NO_DATA_VALUE_USED, String.valueOf(cfb.isNoDataValueUsed())));
contentList.add(createElement(DimapProductConstants.TAG_NO_DATA_VALUE, String.valueOf(cfb.getNoDataValue())));
final List<Element> filterBandInfoList = new ArrayList<>();
filterBandInfoList.add(createElement(DimapProductConstants.TAG_FILTER_SOURCE, cfb.getSource().getName()));
filterBandInfoList.add(convertKernelToElement(cfb.getKernel()));
final Element filterBandInfo = new Element(DimapProductConstants.TAG_FILTER_BAND_INFO);
filterBandInfo.setAttribute("bandType", "ConvolutionFilterBand");
filterBandInfo.addContent(filterBandInfoList);
contentList.add(filterBandInfo);
final Element root = new Element(DimapProductConstants.TAG_SPECTRAL_BAND_INFO);
root.setContent(contentList);
return root;
}
代码示例来源:origin: bcdev/beam
public void testCanDecode_NotCorrectBandType() {
final Element bandInfo = new Element(DimapProductConstants.TAG_SPECTRAL_BAND_INFO);
final Element filterInfo = new Element(DimapProductConstants.TAG_FILTER_BAND_INFO);
final Attribute bandType = new Attribute(DimapProductConstants.ATTRIB_BAND_TYPE, "VirtualBand");
filterInfo.setAttribute(bandType);
bandInfo.setContent(filterInfo);
assertFalse(_persistableSpi.canDecode(bandInfo));
}
代码示例来源:origin: bcdev/beam
public void testCanDecode_GoodElement() {
final Element bandInfo = new Element(DimapProductConstants.TAG_SPECTRAL_BAND_INFO);
final Element filterInfo = new Element(DimapProductConstants.TAG_FILTER_BAND_INFO);
final Attribute bandType = new Attribute(DimapProductConstants.ATTRIB_BAND_TYPE, "GeneralFilterBand");
filterInfo.setAttribute(bandType);
bandInfo.setContent(filterInfo);
assertTrue(_persistableSpi.canDecode(bandInfo));
}
内容来源于网络,如有侵权,请联系作者删除!