getText
public String getText()
-
Returns the text value of this element without recursing through child elements. This method iterates through all
Text,CDATAandEntitynodes that this element contains and appends the text values together. -
-
Returns:
- the textual content of this Element. Child elements are not navigated. This method does not return null;
getTextTrim
public String getTextTrim()
-
DOCUMENT ME!
-
-
Returns:
- the trimmed text value where whitespace is trimmed and normalised into single spaces. This method does not return null.
这样存储到服务器中数据库中的数据肯定和在Tray中数据库中的数据不一样。这个应该是DOM4J不符合习惯用法的地方
本文探讨了DOM4J中getText和getTextTrim方法的区别。getText返回元素的文本内容而不遍历子元素,而getTextTrim则返回修剪后的文本值,其中空白被标准化为单一空格。这一细节对于理解存储在数据库中的数据至关重要。

被折叠的 条评论
为什么被折叠?



