I'd actually noted this in the Wiki write up of this binding: http://www.sosnoski.com/jibx-wiki/space/mixed-content-bindings Right now that's the way text works (which is pretty much standard, since the XML schema string type includes leading/trailing whitespace), so your only alternative is to force trimming of the text yourself. I haven't tried this out, but you should be able to set a deserializer for this purpose, along the lines of:
public static String trimmerDeserializer(String text) {
if (text == null) {
return null;
} else {
return text.trim();
}
}with the binding referencing it:
<value style="text" field="commentText" deserializer="...trimmerDeserializer"/>
In the future I should probably add a separate type for this purpose (style="trimmed-text" perhaps)
- Dennis
Norm Deane wrote:
Thanks Eitan and Dennis. This is working well with one exception... It looks like thw whitespace and newlines around the comment text is not being trimmed. So when this is parsed...
<Comments xml:lang="en-US"> <Attachment> <URL>cid: [EMAIL PROTECTED]</URL> </Attachment> Anything well formed in XML. </Comments>
The value for commentText includes the newline and whitespace. Shouldn't the whitespace be trimmed? Is there any way to control this behavior in the mapping?
Thanks!! Norm
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users
