JiBX 修剪空白歧义
我试图为我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在字符串上显式使用
String.trim()
吗?Can you use
String.trim()
explicitly on the strings?