本文整理了Java中groovy.util.Node.text()
方法的一些代码示例,展示了Node.text()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.text()
方法的具体详情如下:
包路径:groovy.util.Node
类名称:Node
方法名:text
[英]Returns the textual representation of the current node and all its child nodes.
[中]返回当前节点及其所有子节点的文本表示形式。
代码示例来源:origin: org.codehaus.groovy/groovy
private boolean textIsEmptyOrNull() {
String t = text();
return null == t || 0 == t.length();
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a BigInteger object.
*
* @return the GPathResult, converted to a <code>BigInteger</code>
*/
public BigInteger toBigInteger() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toBigInteger((CharSequence)text());
}
代码示例来源:origin: groovy/groovy-core
private boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a Double object.
*
* @return the GPathResult, converted to a <code>Double</code>
*/
public Double toDouble() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toDouble((CharSequence)text());
}
代码示例来源:origin: org.codehaus.groovy/groovy
text = (String) child;
} else if (child instanceof Node) {
text = ((Node) child).text();
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a Float object.
*
* @return the GPathResult, converted to a <code>Float</code>
*/
public Float toFloat() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toFloat((CharSequence)text());
}
代码示例来源:origin: org.codehaus.groovy/groovy
childText = (String) child;
} else if (child instanceof Node) {
childText = ((Node) child).text();
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a Integer object.
*
* @return the GPathResult, converted to a <code>Integer</code>
*/
public Integer toInteger() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toInteger((CharSequence)text());
}
代码示例来源:origin: groovy/groovy-core
protected boolean printSpecialNode(Node node) {
Object name = node.name();
if (name != null && name instanceof QName) {
QName qn = (QName) name;
// check uri and for legacy cases just check prefix name (not recommended)
if (qn.getNamespaceURI().equals("http://groovy.codehaus.org/2005/gsp") || qn.getPrefix().equals("gsp")) {
String s = qn.getLocalPart();
if (s.length() == 0) {
throw new RuntimeException("No local part after 'gsp:' given in node " + node);
}
printGroovyTag(s, node.text());
return true;
}
}
return false;
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a Long object.
*
* @return the GPathResult, converted to a <code>Long</code>
*/
public Long toLong() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toLong((CharSequence)text());
}
代码示例来源:origin: stackoverflow.com
String newText = null;
for ( Node node : document.nodes() ) {
if ( node.text() != null ) newText = "-" + node.text();
}
代码示例来源:origin: org.codehaus.groovy/groovy
/**
* Converts the text of this GPathResult to a BigDecimal object.
*
* @return the GPathResult, converted to a <code>BigDecimal</code>
*/
public BigDecimal toBigDecimal() {
if(textIsEmptyOrNull()){
return null;
}
return StringGroovyMethods.toBigDecimal((CharSequence)text());
}
代码示例来源:origin: org.codehaus.groovy/groovy-xml
private static boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
private boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin
private String findTextOfChild(Node node, String name) {
Node child = findChild(node, name);
return child == null ? null : child.text();
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
private boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: org.kohsuke.droovy/groovy
private boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
private boolean isEmptyElement(Node node) {
if (node == null) {
throw new IllegalArgumentException("Node must not be null!");
}
if (!node.children().isEmpty()) {
return false;
}
return node.text().length() == 0;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Nonnull
private static String getXmlResultsField(Node xml, String field) {
Node f1 = getFirstChild(getFirstChild(xml, "result"), field);
if (f1==null) return "";
return f1.text();
}
}
代码示例来源:origin: io.brooklyn/brooklyn-core
private static String getXmlResultsField(Node xml, String field) {
Node r1 = ((Node)((NodeList)xml.get("result")).get(0));
Node f1 = ((Node)((NodeList)r1.get(field)).get(0));
return f1.text();
}
}
内容来源于网络,如有侵权,请联系作者删除!