JiBX 修剪空白歧义

发布于 2024-11-19 17:25:51 字数 233 浏览 8 评论 0原文

我试图为我的 JiBX 绑定添加修剪功能。根据文档所述,我可以添加自定义转换器,然后添加绑定,或者我可以向节点添加 trim-whitespaces="true" 属性。

现在它可以工作,但并非在所有情况下都有效。 BigDecimals 和布尔值会被修剪,但 Strings 不会。所以我想知道,当 JiBX 尝试使用修剪空白属性来修剪值时,它会考虑什么?是 XSD,还是 java 类的类型?在文档中无法真正找到为什么不修剪字符串。

I was trying to add a trimming feature to my JiBX bindings. From what the documentation said I can either add custom converters and then add in the bindings OR I can add a trim-whitespaces="true" attribute to the node.

Now it works, but not in every case. BigDecimals and booleans get trimmed, but Strings don't. So I was wondering, what does JiBX take into account when it tries to trim values with the trim-whitespace attribute on? Is it the XSD, is it the type from the java class? Can't really find in the documentation why Strings aren't trimmed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她如夕阳 2024-11-26 17:25:51

您可以在字符串上显式使用 String.trim() 吗?

Can you use String.trim() explicitly on the strings?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文