本文整理了Java中org.jdom2.Element.setText()
方法的一些代码示例,展示了Element.setText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setText()
方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:setText
[英]Sets the content of the element to be the text given. All existing text content and non-text context is removed. If this element should have both textual content and nested elements, use #setContent
instead. Setting a null text value is equivalent to setting an empty string value.
[中]将元素的内容设置为给定的文本。将删除所有现有文本内容和非文本上下文。如果此元素同时包含文本内容和嵌套元素,请改用#setContent
。设置空文本值等同于设置空字符串值。
代码示例来源:origin: gocd/gocd
public void populate(Element parent) {
if (requireCdata) {
parent.addContent(new CDATA(valueString()));
} else {
parent.setText(valueString());
}
}
代码示例来源:origin: gocd/gocd
List<Element> encryptedNode = xpathExpression.evaluate(document);
for (Element element : encryptedNode) {
element.setText(reEncryptUsingNewKey(decodeHex(oldCipher), decodeHex(newCipher), element.getValue()));
LOGGER.debug("Replaced encrypted value at {}", element.toString());
代码示例来源:origin: sc.fiji/bigdataviewer-core
protected Element interpolationModeToXml( final Interpolation mode )
{
switch ( mode )
{
case NLINEAR:
return new Element( VIEWERSTATE_INTERPOLATION_TAG ).setText( VIEWERSTATE_INTERPOLATION_VALUE_NLINEAR );
case NEARESTNEIGHBOR:
default:
return new Element( VIEWERSTATE_INTERPOLATION_TAG ).setText( VIEWERSTATE_INTERPOLATION_VALUE_NEARESTNEIGHBOR );
}
}
代码示例来源:origin: org.mycore/mycore-user2
private void addString(Element parent, String name, String value) {
if ((value != null) && (value.trim().length() > 0))
parent.addContent(new Element(name).setText(value.trim()));
}
}
代码示例来源:origin: jpos/jPOS
public synchronized void setReconnectDelay (long delay) {
getPersist().getChild ("reconnect-delay")
.setText (Long.toString (delay));
this.delay = delay;
setModified (true);
}
public long getReconnectDelay () {
代码示例来源:origin: jpos/jPOS
public synchronized void setOutQueue (String out) {
this.out = out;
getPersist().getChild("out").setText (out);
setModified (true);
}
代码示例来源:origin: jpos/jPOS
public synchronized void setOutQueue (String out) {
this.out = out;
getPersist().getChild("out").setText (out);
setModified (true);
}
代码示例来源:origin: jpos/jPOS
public synchronized void setInQueue(String in)
{
String old = this.in;
this.in = in;
if (old != null)
{
sp.out(old, new Object());
}
getPersist().getChild("in").setText(in);
setModified(true);
}
代码示例来源:origin: jpos/jPOS
public synchronized void setOutQueue(String out)
{
this.out = out;
getPersist().getChild("out").setText(out);
setModified(true);
}
代码示例来源:origin: jpos/jPOS
public synchronized void setOutQueue (String out) {
this.out = out;
getPersist().getChild("out").setText (out);
setModified (true);
}
public String getOutQueue () {
代码示例来源:origin: jpos/jPOS
public synchronized void setInQueue (String in) {
String old = this.in;
this.in = in;
if (old != null)
sp.out (old, new Object());
getPersist().getChild("in").setText (in);
setModified (true);
}
代码示例来源:origin: jpos/jPOS
public synchronized void setInQueue (String in) {
this.in = in;
getPersist().getChild("in").setText (in);
setModified (true);
}
public String getInQueue () {
代码示例来源:origin: edu.ucar/cdm
private void writeGeospatialRange(Element parent, Element elem, ThreddsMetadata.Range r) {
if (r == null) return;
elem.addContent(new Element("start", defNS).setText(Double.toString(r.getStart())));
elem.addContent(new Element("size", defNS).setText(Double.toString(r.getSize())));
if (r.hasResolution())
elem.addContent(new Element("resolution", defNS).setText(Double.toString(r.getResolution())));
if (r.getUnits() != null)
elem.addContent(new Element("units", defNS).setText(r.getUnits()));
parent.addContent(elem);
}
代码示例来源:origin: edu.ucar/netcdf
private void writeGeospatialRange(Element parent, Element elem, ThreddsMetadata.Range r) {
if (r == null) return;
elem.addContent( new Element("start", defNS).setText( Double.toString(r.getStart())));
elem.addContent( new Element("size", defNS).setText( Double.toString(r.getSize())));
if (r.hasResolution())
elem.addContent( new Element("resolution", defNS).setText( Double.toString(r.getResolution())));
if (r.getUnits() != null)
elem.addContent( new Element("units", defNS).setText( r.getUnits()));
parent.addContent( elem);
}
代码示例来源:origin: rometools/rome
private void generateRSS2(final CreativeCommons module, final Element element) {
final License[] licenses = module.getLicenses();
for (int i = 0; licenses != null && i < licenses.length; i++) {
final Element license = new Element("license", RSS2);
license.setText(licenses[i].getValue());
element.addContent(license);
}
}
}
代码示例来源:origin: rometools/rome
@Override
protected Element generateHead(final Opml opml) {
final Element docsElement = new Element("docs");
docsElement.setText(opml.getDocs());
final Element headElement = super.generateHead(opml);
headElement.addContent(docsElement);
return headElement;
}
代码示例来源:origin: jpos/jPOS
public synchronized void setInQueue (String in) {
String old = this.in;
this.in = in;
if (old != null)
sp.out (old, Boolean.TRUE);
getPersist().getChild("in").setText (in);
setModified (true);
}
public String getInQueue () {
代码示例来源:origin: dqeasycloud/easy-cloud
/** 更新id为columnList的Text */
protected void updateColumnListText(Element rootElement) {
Element columnListElement = findElementById(EcMyBatisSqlTypeEnum.COLUMN_LIST.getDesc(), rootElement,
EcMyBatisElementNameEnum.SQL.getDesc());
columnListElement.setText(mybatisDTO.buildDatasStr());
}
代码示例来源:origin: jpos/jPOS
private Element regexp (String endpoint, String regexp) {
Element e = new Element("regexp");
e.setAttribute("destination", endpoint);
e.setText(regexp);
return e;
}
代码示例来源:origin: edu.ucar/netcdf
protected Element writeContributor(ThreddsMetadata.Contributor c) {
Element elem = new Element("contributor", defNS);
if (c.getRole() != null)
elem.setAttribute("role", c.getRole());
elem.setText( c.getName());
return elem;
}
内容来源于网络,如有侵权,请联系作者删除!