本文整理汇总了Java中org.dom4j.Element.setText方法的典型用法代码示例。如果您正苦于以下问题:Java Element.setText方法的具体用法?Java Element.setText怎么用?Java Element.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.Element
的用法示例。
在下文中一共展示了Element.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: migrateIntegrationStrategy
import org.dom4j.Element; //导入方法依赖的package包/类
private void migrateIntegrationStrategy(Element integrationStrategyElement) {
if (integrationStrategyElement != null) {
integrationStrategyElement.setName("mergeStrategy");
switch (integrationStrategyElement.getText()) {
case "MERGE_ALWAYS":
integrationStrategyElement.setText("ALWAYS_MERGE");
break;
case "MERGE_WITH_SQUASH":
integrationStrategyElement.setText("SQUASH_MERGE");
break;
case "REBASE_SOURCE_ONTO_TARGET":
integrationStrategyElement.setText("REBASE_MERGE");
break;
case "REBASE_TARGET_ONTO_SOURCE":
integrationStrategyElement.setText("MERGE_IF_NECESSARY");
break;
}
}
}
示例2: parseDto2XmlHasHead
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 将Dto转换为符合XML标准规范格式的字符串(基于节点值形式)
*
* @param map 传入的Dto对象
* @param pRootNodeName 根结点名
* @return string 返回XML格式字符串
*/
public static final String parseDto2XmlHasHead(Map map, String pRootNodeName) {
Document document = DocumentHelper.createDocument();
// 增加一个根元素节点
document.addElement(pRootNodeName);
Element root = document.getRootElement();
Iterator keyIterator = map.keySet().iterator();
while (keyIterator.hasNext()) {
String key = (String)keyIterator.next();
String value = (String)map.get(key);
Element leaf = root.addElement(key);
leaf.setText(value);
}
// 将XML的头声明信息截去
// String outXml = document.asXML().substring(39);
String outXml = document.asXML();
return outXml;
}
示例3: parseList2XmlBasedNode
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 将List数据类型转换为符合XML格式规范的字符串(基于节点值的方式)
*
* @param pList 传入的List数据(List对象可以是Dto、VO、Domain的属性集)
* @param pRootNodeName 根节点名称
* @param pFirstNodeName 行节点名称
* @return string 返回XML格式字符串
*/
public static final String parseList2XmlBasedNode(List pList, String pRootNodeName, String pFirstNodeName) {
Document document = DocumentHelper.createDocument();
Element output = document.addElement(pRootNodeName);
for (int i = 0; i < pList.size(); i++) {
Map map = (Map)pList.get(i);
Element elRow = output.addElement(pFirstNodeName);
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry)it.next();
Element leaf = elRow.addElement((String)entry.getKey());
leaf.setText(String.valueOf(entry.getValue()));
}
}
String outXml = document.asXML().substring(39);
return outXml;
}
示例4: parseDto2Xml
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 将Dto转换为符合XML标准规范格式的字符串(基于节点值形式)
*
* @param dto 传入的Dto对象
* @param pRootNodeName 根结点名
* @return string 返回XML格式字符串
*/
public static final String parseDto2Xml(Map map, String pRootNodeName) {
Document document = DocumentHelper.createDocument();
// 增加一个根元素节点
document.addElement(pRootNodeName);
Element root = document.getRootElement();
Iterator keyIterator = map.keySet().iterator();
while (keyIterator.hasNext()) {
String key = (String) keyIterator.next();
String value = (String) map.get(key);
Element leaf = root.addElement(key);
leaf.setText(value);
}
// 将XML的头声明信息截去
String outXml = document.asXML().substring(39);
return outXml;
}
示例5: replaceSpace
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 替换空格等
*
* @throws UnsupportedEncodingException
*/
public static Document replaceSpace(Document document) {
// 获取根节点元素对象
Element root = document.getRootElement();
// 子节点
List<Element> list = root.elements();
// 使用递归
Iterator<Element> iterator = list.iterator();
while (iterator.hasNext()) {
Element e = iterator.next();
String text = e.getText();
if (text != null && !"".equals(text)) {
text = text.replaceAll(" ", "");
e.setText(text);
}
}
return document;
}
示例6: insertHtmlComment
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Insert an HTML comment into the html source.
*
* @param e NOT YET DOCUMENTED
* @param s NOT YET DOCUMENTED
*/
protected void insertHtmlComment(Element e, String s) {
prtln("\ninsertHtmlComment()");
Element comment = df.createElement("st__htmlComment");
comment.setText(s);
Element parent = e.getParent();
if (parent != null) {
List children = parent.elements();
int index = children.indexOf(e);
children.add(index, comment);
}
else {
// prtlnErr("PARENT NOT FOUND");
}
}
示例7: sessionDestroyed
import org.dom4j.Element; //导入方法依赖的package包/类
public void sessionDestroyed(Session session)
{
Log.debug("OfMeet Plugin - sessionDestroyed "+ session.getAddress().toString() + "\n" + ((ClientSession) session).getPresence().toXML());
boolean skypeAvailable = XMPPServer.getInstance().getPluginManager().getPlugin("ofskype") != null;
if (OfMeetAzure.skypeids.containsKey(session.getAddress().getNode()))
{
String sipuri = OfMeetAzure.skypeids.remove(session.getAddress().getNode());
IQ iq = new IQ(IQ.Type.set);
iq.setFrom(session.getAddress());
iq.setTo(XMPPServer.getInstance().getServerInfo().getXMPPDomain());
Element child = iq.setChildElement("request", "http://igniterealtime.org/protocol/ofskype");
child.setText("{'action':'stop_skype_user', 'sipuri':'" + sipuri + "'}");
XMPPServer.getInstance().getIQRouter().route(iq);
Log.info("OfMeet Plugin - closing skype session " + sipuri);
}
}
示例8: parseList2XmlBasedNode
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 将List数据类型转换为符合XML格式规范的字符串(基于节点值的方式)
*
* @param pList 传入的List数据(List对象可以是Dto、VO、Domain的属性集)
* @param pRootNodeName 根节点名称
* @param pFirstNodeName 行节点名称
* @return string 返回XML格式字符串
*/
public static final String parseList2XmlBasedNode(List pList, String pRootNodeName, String pFirstNodeName) {
Document document = DocumentHelper.createDocument();
Element output = document.addElement(pRootNodeName);
for (int i = 0; i < pList.size(); i++) {
Map map = (Map) pList.get(i);
Element elRow = output.addElement(pFirstNodeName);
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Element leaf = elRow.addElement((String) entry.getKey());
leaf.setText(String.valueOf(entry.getValue()));
}
}
String outXml = document.asXML().substring(39);
return outXml;
}
示例9: getInputHelperElement
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Creates the JSP element to render an input helper for the specified path
*
* @param xpath NOT YET DOCUMENTED
* @return The inputHelper value
*/
public Element getInputHelperElement(String xpath) {
Element inputHelper = null;
if (!this.isEditMode())
return null;
String inputHelperPath = this.rhelper.getInputHelperFile(xpath);
if (inputHelperPath != null) {
String path = "/editor/input_helpers/" + inputHelperPath;
inputHelper = df.createElement("div")
.addAttribute("class", "input-helper");
inputHelper.setText("<%@ include file=\"" + path + "\" %>");
}
return inputHelper;
}
示例10: addHtmlComment
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Adds a feature to the HtmlComment attribute of the MdeNode object
*
* @param e The feature to be added to the HtmlComment attribute
* @param s The feature to be added to the HtmlComment attribute
*/
protected void addHtmlComment(Element e, String s) {
prtln("\ninsertHtmlComment()");
Element comment = df.createElement("st__htmlComment");
comment.setText(s);
e.add(comment);
}
示例11: getOptionalItemControl
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* Creates an optionalItemControl Element that allows user to add or delete an
* optional Element to/from the instance document
*
* @param xpath NOT YET DOCUMENTED
* @return The optionalItemControl Element
*/
public Element getOptionalItemControl(String xpath) {
// prtln ("getOptionalItemControl()");
// test for whether the element exists
Element baseDiv = df.createElement("div");
this.rhelper.embedDebugInfo(baseDiv, "RenderImpl - getOptionalItemControl");
Element elementNotExists = rhelper.nodeNotExistsTest(xpath);
baseDiv.add(elementNotExists);
Element newItemAction = elementNotExists.addElement("span")
.addAttribute("class", "action-button");
Element newItemLink = newItemAction.addElement("a")
.addAttribute("href", "javascript:doNewElement(" + RendererHelper.jspQuotedString(xpath) + ")");
rhelper.attachToolHelp(newItemLink, "Specify the contents of this optional element");
newItemLink.setText("choose");
Element elementExists = rhelper.nodeExistsTest(xpath);
baseDiv.add(elementExists);
Element delItemAction = elementExists.addElement("span")
.addAttribute("class", "action-button");
Element delItemLink = delItemAction.addElement("a")
.addAttribute("href", "javascript:doDeleteElement(" + RendererHelper.jspQuotedString(xpath) + ")");
rhelper.attachToolHelp(delItemLink, "remove this optional element");
delItemLink.setText("remove");
return baseDiv;
}
示例12: addElement
import org.dom4j.Element; //导入方法依赖的package包/类
/**
* 添加节点
*/
private void addElement(Element rootElement, String elementName, Object obj, boolean required) {
if (obj == null && !required) {
return;
}
Assert.notNull(obj, elementName);
Class<?> clazz = obj.getClass();
Element element = rootElement.addElement(elementName);
if (clazz == Integer.class || clazz == Long.class) {
element.setText(obj.toString());
} else {
element.addCDATA(obj.toString());
}
}
示例13: convert
import org.dom4j.Element; //导入方法依赖的package包/类
public Element convert(ComponentInfo component, RuleSet ruleSet,
Element rootElement) throws Exception {
String name=BindingConfig.class.getSimpleName();
XmlNode node=BindingConfig.class.getAnnotation(XmlNode.class);
if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
name=node.nodeName();
}
Rule rule=ruleSet.getRule(name);
BaseElement element = fillElement(component,ruleSet,rule,rootElement);
String[] dsInfo=this.retriveDataSetAndDataPath(component);
if(dsInfo!=null){
String dataPath=dsInfo[1];
int pos=dataPath.lastIndexOf(".");
if(pos!=-1){
dataPath=dataPath.substring(pos+1);
}
Element childrenPropertyElement=new BaseElement("Property");
childrenPropertyElement.addAttribute("name", "childrenProperty");
childrenPropertyElement.setText(dataPath);
element.add(childrenPropertyElement);
}
if(component.getChildren()!=null){
for(ComponentInfo c:component.getChildren()){
this.buildChildren(element,c,ruleSet,rootElement);
}
}
return element;
}
示例14: asElement
import org.dom4j.Element; //导入方法依赖的package包/类
public Element asElement () {
Element guardedpath = df.createElement ("guarded-path");
Element path = guardedpath.addElement ("path");
path.setText (getPath());
Element description = guardedpath.addElement ("description");
description.setText (getDescription());
Element role = guardedpath.addElement ("role");
String roleStr = getRole() == null ? "" : getRole().toString();
role.setText (roleStr);
return guardedpath;
}
示例15: asElement
import org.dom4j.Element; //导入方法依赖的package包/类
public Element asElement () {
Element actionPath = df.createElement ("action-path");
Element path = actionPath.addElement ("path");
path.setText (getPath());
Element description = actionPath.addElement ("description");
description.setText (getDescription());
return actionPath;
}