org.dom4j.Node.setText()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(250)

本文整理了Java中org.dom4j.Node.setText()方法的一些代码示例,展示了Node.setText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.setText()方法的具体详情如下:
包路径:org.dom4j.Node
类名称:Node
方法名:setText

Node.setText介绍

[英]Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.
[中]设置此节点的文本数据,如果此节点是只读的,则此方法将抛出UnsupportedOperationException

代码示例

代码示例来源:origin: org.dom4j/dom4j

  1. public static void setNodeValue(Node node, String nodeValue)
  2. throws DOMException {
  3. node.setText(nodeValue);
  4. }

代码示例来源:origin: org.hibernate/hibernate-annotations

  1. public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
  2. node.setText( toString( value ) );
  3. }

代码示例来源:origin: dom4j/dom4j

  1. public static void setNodeValue(Node node, String nodeValue)
  2. throws DOMException {
  3. node.setText(nodeValue);
  4. }

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

  1. public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
  2. if (value!=null) {
  3. Clob clob = (Clob) value;
  4. try {
  5. int len = (int) clob.length();
  6. node.setText( clob.getSubString(0, len) );
  7. }
  8. catch (SQLException sqle) {
  9. throw new HibernateException("could not read XML from Clob", sqle);
  10. }
  11. }
  12. }

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

  1. public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
  2. throws HibernateException {
  3. node.setText( toXMLString(value, factory) );
  4. }

代码示例来源:origin: hibernate/hibernate

  1. public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
  2. if (value!=null) {
  3. Clob clob = (Clob) value;
  4. try {
  5. int len = (int) clob.length();
  6. node.setText( clob.getSubString(0, len) );
  7. }
  8. catch (SQLException sqle) {
  9. throw new HibernateException("could not read XML from Clob", sqle);
  10. }
  11. }
  12. }

代码示例来源:origin: rememberber/WeSync

  1. public void setPositionCode(String positionCode) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_POSITION_CODE).setText(positionCode);
  3. writeToXml();
  4. }
  5. }

代码示例来源:origin: rememberber/WeSync

  1. public void setAutoBak(String autoBak) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_AUTO_BAK).setText(autoBak);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setDebugMode(String debugMode) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_DEBUG_MODE).setText(debugMode);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setLastKeepTime(String lastKeepTime) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_LAST_KEEP_TIME).setText(lastKeepTime);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setUserFrom(String userFrom) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_USER_FROM).setText(userFrom);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setTypeTo(String typeTo) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_TYPE_TO).setText(typeTo);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setUserTo(String userTo) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_USER_TO).setText(userTo);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setProductName(String productName) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_PRODUCT_NAME).setText(productName);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setLastSyncTime(String lastSyncTime) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_LAST_SYNC_TIME).setText(lastSyncTime);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setSuccessTime(String successTime) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_SUCCESS_TIME).setText(successTime);
  3. writeToXml();
  4. }

代码示例来源:origin: rememberber/WeSync

  1. public void setHostFrom(String hostFrom) throws Exception {
  2. this.document.selectSingleNode(ConstantsTools.XPATH_HOST_FROM).setText(hostFrom);
  3. writeToXml();
  4. }

代码示例来源:origin: yejq/quartz-spring-manager

  1. public static void pausedTriggerInConfig(String triggerName) throws Exception {
  2. Document document = getConfigDocument();
  3. Node node_desc = document.selectSingleNode("/beans/bean[@id='" + triggerName
  4. + "']/property[@name='description']/@value");
  5. String content = node_desc.getText();
  6. if (content == null) {
  7. content = "";
  8. }
  9. node_desc.setText(content + PAUSED_FLAG);
  10. saveConfig(document);
  11. }

代码示例来源:origin: dom4j/dom4j

  1. public void testSetText1() throws Exception {
  2. String newURL = "newURL";
  3. Node urlNode = document.selectSingleNode("//root/author[1]/url");
  4. urlNode.setText(newURL);
  5. assertEquals(newURL, urlNode.getText());
  6. assertTrue(urlNode instanceof Element);
  7. Element urlElement = (Element) urlNode;
  8. assertEquals(0, urlElement.elements().size());
  9. }

代码示例来源:origin: dom4j/dom4j

  1. public void testSetText2() throws Exception {
  2. String newName = "Strachem James";
  3. Node authorNode = document.selectSingleNode("//root/author[1]");
  4. authorNode.setText(newName);
  5. assertEquals(newName, authorNode.getText());
  6. assertTrue(authorNode instanceof Element);
  7. Element urlElement = (Element) authorNode;
  8. assertEquals(1, urlElement.elements().size());
  9. }
  10. }

相关文章