非习惯用法

getText

public String getText()
Returns the text value of this element without recursing through child elements. This method iterates through all Text, CDATA and Entitynodes that this element contains and appends the text values together.

Specified by:
getText in interface Node
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.
这两个小方法事实上是有一点区别的。getTextTrim将whitespace转换成为了single space。也就是将那些回车换行都变成了空格字符。这个在开发的时候没有看到这么一点区别。我以为所有的Trim方法都是将前面和后面的空白字符给去掉,没有想到这里的前导空白字符都被变成了空白字符了。

这样存储到服务器中数据库中的数据肯定和在Tray中数据库中的数据不一样。这个应该是DOM4J不符合习惯用法的地方
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值