本文整理汇总了Java中org.kxml2.kdom.Node.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getChildCount方法的具体用法?Java Node.getChildCount怎么用?Java Node.getChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kxml2.kdom.Node
的用法示例。
在下文中一共展示了Node.getChildCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getXMLText
import org.kxml2.kdom.Node; //导入方法依赖的package包/类
/**
* reads all subsequent text nodes and returns the combined string
* needed because escape sequences are parsed into consecutive text nodes
* e.g. "abc&123" --> (abc)(&)(123)
**/
public static String getXMLText (Node node, int i, boolean trim) {
StringBuilder strBuff = null;
String text = node.getText(i);
if (text == null)
return null;
for (i++; i < node.getChildCount() && node.getType(i) == Node.TEXT; i++) {
if (strBuff == null)
strBuff = new StringBuilder(text);
strBuff.append(node.getText(i));
}
if (strBuff != null)
text = strBuff.toString();
if (trim)
text = text.trim();
return text;
}
示例2: getXMLText
import org.kxml2.kdom.Node; //导入方法依赖的package包/类
/**
* reads all subsequent text nodes and returns the combined string
* needed because escape sequences are parsed into consecutive text nodes
* e.g. "abc&123" --> (abc)(&)(123)
*/
public static String getXMLText(Node node, int i, boolean trim) {
StringBuffer strBuff = null;
String text = node.getText(i);
if (text == null)
return null;
for (i++; i < node.getChildCount() && node.getType(i) == Node.TEXT; i++) {
if (strBuff == null)
strBuff = new StringBuffer(text);
strBuff.append(node.getText(i));
}
if (strBuff != null)
text = strBuff.toString();
if (trim)
text = text.trim();
return text;
}