org.dom4j.Text.getText()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(155)

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

Text.getText介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

/** Writes the given {@link Text}.
 *
 * @param text <code>Text</code> to output.
 */
public void write(Text text) throws IOException {
  writeString(text.getText());
  if ( autoFlush ) {
    flush();
  }
}

代码示例来源:origin: igniterealtime/Openfire

buffer = new StringBuilder( lastTextNode.getText() );
    writeString( lastTextNode.getText() );
writeString( lastTextNode.getText() );

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Writes the given {@link Text}.
 * 
 * @param text
 *            <code>Text</code> to output.
 * 
 * @throws IOException
 *             DOCUMENT ME!
 */
public void write(Text text) throws IOException {
  writeString(text.getText());
  if (autoFlush) {
    flush();
  }
}

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

previousText.appendText(text.getText());
String value = text.getText();

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

protected void writeContent(Branch branch, NamespaceStack namespaceStack)
    throws SAXException {
  for (Iterator<Node> iter = branch.nodeIterator(); iter.hasNext();) {
    Node node = iter.next();
    if (node instanceof Element) {
      write((Element) node, namespaceStack);
    } else if (node instanceof CharacterData) {
      if (node instanceof Text) {
        Text text = (Text) node;
        write(text.getText());
      } else if (node instanceof CDATA) {
        write((CDATA) node);
      } else if (node instanceof Comment) {
        write((Comment) node);
      } else {
        throw new SAXException("Invalid Node in DOM4J content: "
            + node + " of type: " + node.getClass());
      }
    } else if (node instanceof Entity) {
      write((Entity) node);
    } else if (node instanceof ProcessingInstruction) {
      write((ProcessingInstruction) node);
    } else if (node instanceof Namespace) {
      write((Namespace) node);
    } else {
      throw new SAXException("Invalid Node in DOM4J content: "
          + node);
    }
  }
}

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

} else {
    if (buff == null) {
      buff = new StringBuilder(lastTextNode.getText());
      startsWithWhitespace = startsWithWhitespace(buff);
    } else if (lastTextNode != null) {
      startsWithWhitespace = startsWithWhitespace(lastTextNode.getText());
    } else {
      startsWithWhitespace = false;
      buff = null;
    } else {
      writeString(lastTextNode.getText());
        endsWithWhitespace = endsWithWhitespace(buff);
      } else {
        endsWithWhitespace = endsWithWhitespace(lastTextNode.getText());
    startsWithWhitespace = startsWithWhitespace(buff);
  } else {
    startsWithWhitespace = startsWithWhitespace(lastTextNode.getText());
  buff = null;
} else {
  writeString(lastTextNode.getText());

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

protected void appendDOMTree(org.w3c.dom.Document domDocument,
    org.w3c.dom.Node domCurrent, List<Node> content) {
  for (Node node : content) {
    if (node instanceof Element) {
      appendDOMTree(domDocument, domCurrent, (Element) node);
    } else if (node instanceof Text) {
      Text text = (Text) node;
      appendDOMTree(domDocument, domCurrent, text.getText());
    } else if (node instanceof CDATA) {
      appendDOMTree(domDocument, domCurrent, (CDATA) node);
    } else if (node instanceof Comment) {
      appendDOMTree(domDocument, domCurrent, (Comment) node);
    } else if (node instanceof Entity) {
      appendDOMTree(domDocument, domCurrent, (Entity) node);
    } else if (node instanceof ProcessingInstruction) {
      appendDOMTree(domDocument, domCurrent,
          (ProcessingInstruction) node);
    }
  }
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

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

/**
 * Constructs a STAX {@link Characters}event from a DOM4J {@link Text}.
 * 
 * @param text
 *            The {@link Text}from which to construct the event.
 * 
 * @return The constructed {@link Characters}event.
 */
public Characters createCharacters(Text text) {
  return factory.createCharacters(text.getText());
}

代码示例来源:origin: org.nuiton.jrst/jrst

@Override
public void text(Text t) {
  if (LITERAL_BLOCK.equals(t.getParent().getName())) {
    writeIndent(t.getText());
  } else {
    write(t.getText());
  }
}

代码示例来源:origin: com.github.jjYBdx4IL.utils/xml-dom4j-utils

public static boolean hasTextChildsWithNonWhitespace(Element element) {
  for (Object node : element.content()) {
    Node e1 = (Node) node;
    if (e1.getNodeType() != Node.TEXT_NODE) {
      continue;
    }
    Text textNode = (Text) e1;
    if (!textNode.getText().trim().isEmpty()) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.igniterealtime.openfire/xmppserver

/** Writes the given {@link Text}.
 *
 * @param text <code>Text</code> to output.
 */
public void write(Text text) throws IOException {
  writeString(text.getText());
  if ( autoFlush ) {
    flush();
  }
}

代码示例来源:origin: com.github.jjYBdx4IL.utils/xml-dom4j-utils

public void visit(Text node) {
    Element parent = node.getParent();
    if (hasNonTextChilds(parent) && !hasTextChildsWithNonWhitespace(parent)) {
      node.setText(node.getText().trim());
    }
  }
};

相关文章

微信公众号

最新文章

更多