本文整理匯總了Java中org.jdom.Element.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.setText方法的具體用法?Java Element.setText怎麽用?Java Element.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdom.Element
的用法示例。
在下文中一共展示了Element.setText方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cut
import org.jdom.Element; //導入方法依賴的package包/類
public static void cut(Document doc) {
// Iterate over all salary elements
Iterator<?> iterator = doc.getDescendants(new ElementFilter("salary"));
// Snapshot these elements before modification
List<Element> elems = new LinkedList<Element>();
while (iterator.hasNext())
elems.add((Element)iterator.next());
// Iterate over salary elements and cut salaries
for (Element elem : elems) {
Double salary = Double.valueOf(elem.getText());
elem.setText(Double.toString(salary/2));
}
}
示例2: createGcp
import org.jdom.Element; //導入方法依賴的package包/類
public static Element createGcp(double lon, double lat, double x, double y) {
Element gcp = new Element("gcp");
Element row = new Element("row");
row.setText((int) y + "");
gcp.addContent(row);
Element column = new Element("column");
column.setText((int) x + "");
gcp.addContent(column);
Element lone = new Element("lon");
lone.setText(lon + "");
gcp.addContent(lone);
Element late = new Element("lat");
late.setText(lat + "");
gcp.addContent(late);
return gcp;
}
示例3: getCreoleXML
import org.jdom.Element; //導入方法依賴的package包/類
@Override
public Document getCreoleXML() throws Exception, JDOMException {
Document doc = new Document();
Element element;
doc.addContent(element = new Element("CREOLE-DIRECTORY"));
element.addContent(element = new Element("CREOLE"));
element.addContent(element = new Element("RESOURCE"));
Element classElement = new Element("CLASS");
classElement.setText(resourceClass.getName());
element.addContent(classElement);
return doc;
}
示例4: getNewElement
import org.jdom.Element; //導入方法依賴的package包/類
protected Element getNewElement() {
Element mavenPlugin = new Element("gate.creole.Plugin-Maven");
Element groupElement = new Element("group");
groupElement.setText(groupID);
Element artifactElement = new Element("artifact");
artifactElement.setText(artifactID);
Element versionElement = new Element("version");
versionElement.setText(version.toString());
mavenPlugin.addContent(groupElement);
mavenPlugin.addContent(artifactElement);
mavenPlugin.addContent(versionElement);
return mavenPlugin;
}
示例5: getCreoleXML
import org.jdom.Element; //導入方法依賴的package包/類
@Override
public Document getCreoleXML() throws Exception, JDOMException {
Document doc = new Document();
Element element = null;
doc.addContent(element = new Element("CREOLE-DIRECTORY"));
element.addContent(element = new Element("CREOLE"));
element.addContent(element = new Element("RESOURCE"));
Element classElement = new Element("CLASS");
classElement.setText(TestResource.class.getName());
element.addContent(classElement);
return doc;
}
示例6: addNewNote
import org.jdom.Element; //導入方法依賴的package包/類
/**
* Adds a new Note Element to Root element
*
* @return Added Note Element
*/
public void addNewNote(String notes) {
Element note = new Element("note");
note.setAttribute("title", titleFormat.format(new Date()));
note.setAttribute("createdt", sdf.format(new Date()));
note.setText(notes);
element.addContent(note);
selectNote(element.getChildren().size() - 1, true);
quickNotesManager.syncQuickNotePanels(id);
}
示例7: writeExternal
import org.jdom.Element; //導入方法依賴的package包/類
@Override
public void writeExternal(final Element element) throws WriteExternalException {
super.writeExternal(element);
if (this.runFilePath != null) {
final Element fileElement = new Element("file");
fileElement.setText(this.runFilePath);
element.addContent(fileElement);
}
}